Search in sources :

Example 1 with AesGcmJce

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

the class AesGcmKeyManager method getPrimitive.

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

Aggregations

AesGcmKey (com.google.crypto.tink.proto.AesGcmKey)1 AesGcmJce (com.google.crypto.tink.subtle.AesGcmJce)1 GeneralSecurityException (java.security.GeneralSecurityException)1