use of com.google.crypto.tink.subtle.ChaCha20Poly1305 in project tink by google.
the class ChaCha20Poly1305KeyManager method getPrimitive.
@Override
public Aead getPrimitive(MessageLite key) throws GeneralSecurityException {
if (!(key instanceof ChaCha20Poly1305Key)) {
throw new GeneralSecurityException("expected ChaCha20Poly1305Key proto");
}
ChaCha20Poly1305Key keyProto = (ChaCha20Poly1305Key) key;
validate(keyProto);
return new ChaCha20Poly1305(keyProto.getKeyValue().toByteArray());
}
Aggregations