Search in sources :

Example 1 with AesEaxJce

use of com.google.crypto.tink.subtle.AesEaxJce in project tink by google.

the class AesEaxKeyManager method getPrimitive.

/**
 * @param key {@code AesEaxKey} proto
 */
@Override
public Aead getPrimitive(MessageLite key) throws GeneralSecurityException {
    if (!(key instanceof AesEaxKey)) {
        throw new GeneralSecurityException("expected AesEaxKey proto");
    }
    AesEaxKey keyProto = (AesEaxKey) key;
    validate(keyProto);
    return new AesEaxJce(keyProto.getKeyValue().toByteArray(), keyProto.getParams().getIvSize());
}
Also used : AesEaxKey(com.google.crypto.tink.proto.AesEaxKey) GeneralSecurityException(java.security.GeneralSecurityException) AesEaxJce(com.google.crypto.tink.subtle.AesEaxJce)

Aggregations

AesEaxKey (com.google.crypto.tink.proto.AesEaxKey)1 AesEaxJce (com.google.crypto.tink.subtle.AesEaxJce)1 GeneralSecurityException (java.security.GeneralSecurityException)1