use of com.google.crypto.tink.subtle.AesGcmHkdfStreaming in project tink by google.
the class AesGcmHkdfStreamingKeyManager method getPrimitive.
/**
* @param key {@code AesGcmHkdfStreamingKey} proto
*/
@Override
public StreamingAead getPrimitive(MessageLite key) throws GeneralSecurityException {
if (!(key instanceof AesGcmHkdfStreamingKey)) {
throw new GeneralSecurityException("expected AesGcmHkdfStreamingKey proto");
}
AesGcmHkdfStreamingKey keyProto = (AesGcmHkdfStreamingKey) key;
validate(keyProto);
return new AesGcmHkdfStreaming(keyProto.getKeyValue().toByteArray(), StreamingAeadUtil.toHmacAlgo(keyProto.getParams().getHkdfHashType()), keyProto.getParams().getDerivedKeySize(), keyProto.getParams().getCiphertextSegmentSize(), /* firstSegmentOffset= */
0);
}
Aggregations