use of com.google.crypto.tink.proto.KmsAeadKey in project tink by google.
the class KmsAeadKeyManager method getPrimitive.
/**
* @param key {@code KmsAeadKey} proto
*/
@Override
public Aead getPrimitive(MessageLite key) throws GeneralSecurityException {
if (!(key instanceof KmsAeadKey)) {
throw new GeneralSecurityException("expected KmsAeadKey proto");
}
KmsAeadKey keyProto = (KmsAeadKey) key;
validate(keyProto);
String keyUri = keyProto.getParams().getKeyUri();
KmsClient kmsClient = KmsClients.get(keyUri);
return kmsClient.getAead(keyUri);
}
Aggregations