Package org.bouncycastle.crypto.tls
Class Chacha20Poly1305
- java.lang.Object
-
- org.bouncycastle.crypto.tls.Chacha20Poly1305
-
-
Field Summary
Fields Modifier and Type Field Description protected TlsContext
context
protected ChaCha7539Engine
decryptCipher
protected byte[]
decryptIV
protected ChaCha7539Engine
encryptCipher
protected byte[]
encryptIV
-
Constructor Summary
Constructors Constructor Description Chacha20Poly1305(TlsContext context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected byte[]
calculateNonce(long seqNo, byte[] iv)
protected byte[]
calculateRecordMAC(KeyParameter macKey, byte[] additionalData, byte[] buf, int off, int len)
byte[]
decodeCiphertext(long seqNo, short type, byte[] ciphertext, int offset, int len)
byte[]
encodePlaintext(long seqNo, short type, byte[] plaintext, int offset, int len)
protected KeyParameter
generateRecordMACKey(StreamCipher cipher)
protected byte[]
getAdditionalData(long seqNo, short type, int len)
int
getPlaintextLimit(int ciphertextLimit)
protected KeyParameter
initRecord(StreamCipher cipher, boolean forEncryption, long seqNo, byte[] iv)
protected void
updateRecordMACLength(Mac mac, int len)
protected void
updateRecordMACText(Mac mac, byte[] buf, int off, int len)
-
-
-
Field Detail
-
context
protected TlsContext context
-
encryptCipher
protected ChaCha7539Engine encryptCipher
-
decryptCipher
protected ChaCha7539Engine decryptCipher
-
encryptIV
protected byte[] encryptIV
-
decryptIV
protected byte[] decryptIV
-
-
Constructor Detail
-
Chacha20Poly1305
public Chacha20Poly1305(TlsContext context) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
getPlaintextLimit
public int getPlaintextLimit(int ciphertextLimit)
- Specified by:
getPlaintextLimit
in interfaceTlsCipher
-
encodePlaintext
public byte[] encodePlaintext(long seqNo, short type, byte[] plaintext, int offset, int len) throws java.io.IOException
- Specified by:
encodePlaintext
in interfaceTlsCipher
- Throws:
java.io.IOException
-
decodeCiphertext
public byte[] decodeCiphertext(long seqNo, short type, byte[] ciphertext, int offset, int len) throws java.io.IOException
- Specified by:
decodeCiphertext
in interfaceTlsCipher
- Throws:
java.io.IOException
-
initRecord
protected KeyParameter initRecord(StreamCipher cipher, boolean forEncryption, long seqNo, byte[] iv)
-
calculateNonce
protected byte[] calculateNonce(long seqNo, byte[] iv)
-
generateRecordMACKey
protected KeyParameter generateRecordMACKey(StreamCipher cipher)
-
calculateRecordMAC
protected byte[] calculateRecordMAC(KeyParameter macKey, byte[] additionalData, byte[] buf, int off, int len)
-
updateRecordMACLength
protected void updateRecordMACLength(Mac mac, int len)
-
updateRecordMACText
protected void updateRecordMACText(Mac mac, byte[] buf, int off, int len)
-
getAdditionalData
protected byte[] getAdditionalData(long seqNo, short type, int len) throws java.io.IOException
- Throws:
java.io.IOException
-
-