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