Search in sources :

Example 1 with AesSiv

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

the class AesSivKeyManager method getPrimitive.

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

Aggregations

AesSivKey (com.google.crypto.tink.proto.AesSivKey)1 AesSiv (com.google.crypto.tink.subtle.AesSiv)1 GeneralSecurityException (java.security.GeneralSecurityException)1