@Test public void testSmallPlaintextWithRawKey() throws Exception { byte[] aesCtrKeyValue = Random.randBytes(AES_KEY_SIZE); byte[] hmacKeyValue = Random.randBytes(HMAC_KEY_SIZE); int ivSize = 12; int tagSize = 16; Key primary = TestUtil.createKey( TestUtil.createAesCtrHmacAeadKeyData(aesCtrKeyValue, ivSize, hmacKeyValue, tagSize), 42, KeyStatusType.ENABLED, OutputPrefixType.RAW); KeysetHandle keysetHandle = TestUtil.createKeysetHandle(TestUtil.createKeyset(primary)); Aead aead = keysetHandle.getPrimitive(Aead.class); byte[] plaintext = Random.randBytes(1); byte[] associatedData = Random.randBytes(20); byte[] ciphertext = aead.encrypt(plaintext, associatedData); assertArrayEquals(plaintext, aead.decrypt(ciphertext, associatedData)); assertEquals( CryptoFormat.RAW_PREFIX_SIZE + plaintext.length + ivSize + tagSize, ciphertext.length); }
@Deprecated public static Aead getPrimitive(KeysetHandle keysetHandle) throws GeneralSecurityException { return getPrimitive(keysetHandle, null); }
AeadFactory { @Deprecated public static Aead getPrimitive(KeysetHandle keysetHandle) throws GeneralSecurityException { return getPrimitive(keysetHandle, null); } }
AeadFactory { @Deprecated public static Aead getPrimitive(KeysetHandle keysetHandle) throws GeneralSecurityException { return getPrimitive(keysetHandle, null); }  }
AeadFactory { @Deprecated public static Aead getPrimitive(KeysetHandle keysetHandle) throws GeneralSecurityException { return getPrimitive(keysetHandle, null); }  @Deprecated static Aead getPrimitive(KeysetHandle keysetHandle); @Deprecated static Aead getPrimitive(KeysetHandle keysetHandle, final KeyManager<Aead> keyManager); }
AeadFactory { @Deprecated public static Aead getPrimitive(KeysetHandle keysetHandle) throws GeneralSecurityException { return getPrimitive(keysetHandle, null); }  @Deprecated static Aead getPrimitive(KeysetHandle keysetHandle); @Deprecated static Aead getPrimitive(KeysetHandle keysetHandle, final KeyManager<Aead> keyManager);  }