use of com.google.crypto.tink.HybridDecrypt in project tink by google.
the class WebPushHybridDecryptTest method testWithRfc8291TestVector.
@Test
public void testWithRfc8291TestVector() throws Exception {
byte[] plaintext = Base64.urlSafeDecode(PLAINTEXT);
byte[] recipientPrivateKey = Base64.urlSafeDecode(RECEIVER_PRIVATE_KEY);
byte[] recipientPublicKey = Base64.urlSafeDecode(RECEIVER_PUBLIC_KEY);
byte[] authSecret = Base64.urlSafeDecode(AUTH_SECRET);
byte[] ciphertext = Base64.urlSafeDecode(CIPHERTEXT);
HybridDecrypt hybridDecrypt = new WebPushHybridDecrypt.Builder().withRecordSize(RECORD_SIZE).withAuthSecret(authSecret).withRecipientPublicKey(recipientPublicKey).withRecipientPrivateKey(recipientPrivateKey).build();
assertArrayEquals(plaintext, hybridDecrypt.decrypt(ciphertext, null));
}
Aggregations