use of com.wultra.security.powerauth.client.v3.StartUpgradeResponse in project powerauth-restful-integration by lime-company.
the class UpgradeService method upgradeStart.
/**
* Start upgrade of activation to version 3.
* @param request ECIES encrypted upgrade start request.
* @param header PowerAuth encryption HTTP header.
* @return ECIES encrypted upgrade activation response.
* @throws PowerAuthUpgradeException In case upgrade start fails.
*/
public EciesEncryptedResponse upgradeStart(EciesEncryptedRequest request, PowerAuthEncryptionHttpHeader header) throws PowerAuthUpgradeException {
try {
// Fetch data from the request
final String ephemeralPublicKey = request.getEphemeralPublicKey();
final String encryptedData = request.getEncryptedData();
final String mac = request.getMac();
final String nonce = request.getNonce();
// Get ECIES headers
final String activationId = header.getActivationId();
final String applicationKey = header.getApplicationKey();
// Start upgrade on PowerAuth server
final StartUpgradeResponse upgradeResponse = powerAuthClient.startUpgrade(activationId, applicationKey, ephemeralPublicKey, encryptedData, mac, nonce);
// Prepare a response
final EciesEncryptedResponse response = new EciesEncryptedResponse();
response.setMac(upgradeResponse.getMac());
response.setEncryptedData(upgradeResponse.getEncryptedData());
return response;
} catch (Exception ex) {
logger.warn("PowerAuth upgrade start failed, error: {}", ex.getMessage());
logger.debug(ex.getMessage(), ex);
throw new PowerAuthUpgradeException();
}
}
Aggregations