Search in sources :

Example 1 with AesGcmHkdfStreaming

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);
}
Also used : AesGcmHkdfStreamingKey(com.google.crypto.tink.proto.AesGcmHkdfStreamingKey) GeneralSecurityException(java.security.GeneralSecurityException) AesGcmHkdfStreaming(com.google.crypto.tink.subtle.AesGcmHkdfStreaming)

Aggregations

AesGcmHkdfStreamingKey (com.google.crypto.tink.proto.AesGcmHkdfStreamingKey)1 AesGcmHkdfStreaming (com.google.crypto.tink.subtle.AesGcmHkdfStreaming)1 GeneralSecurityException (java.security.GeneralSecurityException)1