Search in sources :

Example 1 with GetEciesDecryptorRequest

use of com.wultra.security.powerauth.client.v3.GetEciesDecryptorRequest in project powerauth-restful-integration by lime-company.

the class PowerAuthEncryptionProvider method getEciesDecryptorParameters.

@Override
@Nonnull
public PowerAuthEciesDecryptorParameters getEciesDecryptorParameters(@Nullable String activationId, @Nonnull String applicationKey, @Nonnull String ephemeralPublicKey) throws PowerAuthEncryptionException {
    try {
        GetEciesDecryptorRequest eciesDecryptorRequest = new GetEciesDecryptorRequest();
        eciesDecryptorRequest.setActivationId(activationId);
        eciesDecryptorRequest.setApplicationKey(applicationKey);
        eciesDecryptorRequest.setEphemeralPublicKey(ephemeralPublicKey);
        GetEciesDecryptorResponse eciesDecryptorResponse = powerAuthClient.getEciesDecryptor(eciesDecryptorRequest);
        return new PowerAuthEciesDecryptorParameters(eciesDecryptorResponse.getSecretKey(), eciesDecryptorResponse.getSharedInfo2());
    } catch (Exception ex) {
        logger.warn("Get ECIES decryptor call failed, error: {}", ex.getMessage());
        logger.debug(ex.getMessage(), ex);
        throw new PowerAuthEncryptionException();
    }
}
Also used : PowerAuthEncryptionException(io.getlime.security.powerauth.rest.api.spring.exception.PowerAuthEncryptionException) GetEciesDecryptorRequest(com.wultra.security.powerauth.client.v3.GetEciesDecryptorRequest) GetEciesDecryptorResponse(com.wultra.security.powerauth.client.v3.GetEciesDecryptorResponse) PowerAuthEncryptionException(io.getlime.security.powerauth.rest.api.spring.exception.PowerAuthEncryptionException) PowerAuthEciesDecryptorParameters(io.getlime.security.powerauth.rest.api.spring.encryption.PowerAuthEciesDecryptorParameters) Nonnull(javax.annotation.Nonnull)

Aggregations

GetEciesDecryptorRequest (com.wultra.security.powerauth.client.v3.GetEciesDecryptorRequest)1 GetEciesDecryptorResponse (com.wultra.security.powerauth.client.v3.GetEciesDecryptorResponse)1 PowerAuthEciesDecryptorParameters (io.getlime.security.powerauth.rest.api.spring.encryption.PowerAuthEciesDecryptorParameters)1 PowerAuthEncryptionException (io.getlime.security.powerauth.rest.api.spring.exception.PowerAuthEncryptionException)1 Nonnull (javax.annotation.Nonnull)1