Class InsecureNonceChaCha20
- java.lang.Object
-
- com.google.crypto.tink.aead.internal.InsecureNonceChaCha20
-
public class InsecureNonceChaCha20 extends java.lang.ObjectA stream cipher, as described in RFC 8439 https://tools.ietf.org/html/rfc8439, section 2.4.This cipher is meant to be used to construct an AEAD with Poly1305.
-
-
Constructor Summary
Constructors Constructor Description InsecureNonceChaCha20(byte[] key, int initialCounter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int[]createInitialState(int[] nonce, int counter)byte[]decrypt(byte[] nonce, byte[] ciphertext)Decryptsciphertextusingnonce.byte[]decrypt(byte[] nonce, java.nio.ByteBuffer ciphertext)Decryptsciphertextusingnonce.byte[]encrypt(byte[] nonce, byte[] plaintext)Encryptsplaintextusingnonce.voidencrypt(java.nio.ByteBuffer output, byte[] nonce, byte[] plaintext)Encryptsplaintextusingnonceand writes result tooutput.intnonceSizeInBytes()
-
-
-
Method Detail
-
createInitialState
public int[] createInitialState(int[] nonce, int counter)
-
nonceSizeInBytes
public int nonceSizeInBytes()
-
encrypt
public byte[] encrypt(byte[] nonce, byte[] plaintext) throws java.security.GeneralSecurityExceptionEncryptsplaintextusingnonce.- Throws:
java.security.GeneralSecurityException
-
encrypt
public void encrypt(java.nio.ByteBuffer output, byte[] nonce, byte[] plaintext) throws java.security.GeneralSecurityExceptionEncryptsplaintextusingnonceand writes result tooutput.- Throws:
java.security.GeneralSecurityException
-
decrypt
public byte[] decrypt(byte[] nonce, byte[] ciphertext) throws java.security.GeneralSecurityExceptionDecryptsciphertextusingnonce.- Throws:
java.security.GeneralSecurityException
-
decrypt
public byte[] decrypt(byte[] nonce, java.nio.ByteBuffer ciphertext) throws java.security.GeneralSecurityExceptionDecryptsciphertextusingnonce.- Throws:
java.security.GeneralSecurityException
-
-