Modifier and Type | Field and Description |
---|---|
protected TlsCrypto |
crypto |
protected TlsCryptoParameters |
cryptoParams |
protected TlsBlockCipherImpl |
decryptCipher |
protected TlsBlockCipherImpl |
encryptCipher |
protected boolean |
encryptThenMAC |
protected byte[] |
randomData |
protected TlsSuiteMac |
readMac |
protected boolean |
useExplicitIV |
protected boolean |
useExtraPadding |
protected TlsSuiteMac |
writeMac |
Constructor and Description |
---|
TlsBlockCipher(TlsCrypto crypto,
TlsCryptoParameters cryptoParams,
TlsBlockCipherImpl encryptCipher,
TlsBlockCipherImpl decryptCipher,
TlsHMAC clientMac,
TlsHMAC serverMac,
int cipherKeySize) |
Modifier and Type | Method and Description |
---|---|
protected int |
checkPaddingConstantTime(byte[] buf,
int off,
int len,
int blockSize,
int macSize) |
protected int |
chooseExtraPadBlocks(java.security.SecureRandom r,
int max) |
byte[] |
decodeCiphertext(long seqNo,
short type,
byte[] ciphertext,
int offset,
int len)
Validate and decrypt the passed in cipher text using the current cipher suite.
|
byte[] |
encodePlaintext(long seqNo,
short type,
byte[] plaintext,
int offset,
int len)
Encrypt and MAC the passed in plain text using the current cipher suite.
|
int |
getPlaintextLimit(int ciphertextLimit)
Return the maximum size for the plaintext given ciphertextlimit bytes of ciphertext.
|
protected int |
lowestBitSet(int x) |
protected final TlsCrypto crypto
protected final TlsCryptoParameters cryptoParams
protected final byte[] randomData
protected final boolean encryptThenMAC
protected final boolean useExplicitIV
protected final boolean useExtraPadding
protected final TlsBlockCipherImpl decryptCipher
protected final TlsBlockCipherImpl encryptCipher
protected final TlsSuiteMac readMac
protected final TlsSuiteMac writeMac
public TlsBlockCipher(TlsCrypto crypto, TlsCryptoParameters cryptoParams, TlsBlockCipherImpl encryptCipher, TlsBlockCipherImpl decryptCipher, TlsHMAC clientMac, TlsHMAC serverMac, int cipherKeySize) throws java.io.IOException
java.io.IOException
public int getPlaintextLimit(int ciphertextLimit)
TlsCipher
getPlaintextLimit
in interface TlsCipher
ciphertextLimit
- the maximum number of bytes of ciphertext.public byte[] encodePlaintext(long seqNo, short type, byte[] plaintext, int offset, int len) throws java.io.IOException
TlsCipher
encodePlaintext
in interface TlsCipher
seqNo
- sequence number of the message represented by plaintext.type
- content type of the message represented by plaintext.plaintext
- array holding input plain text to the cipher.offset
- offset into input array the plain text starts at.len
- length of the plaintext in the array.java.io.IOException
public byte[] decodeCiphertext(long seqNo, short type, byte[] ciphertext, int offset, int len) throws java.io.IOException
TlsCipher
decodeCiphertext
in interface TlsCipher
seqNo
- sequence number of the message represented by ciphertext.type
- content type of the message represented by ciphertext.ciphertext
- array holding input cipher text to the cipher.offset
- offset into input array the cipher text starts at.len
- length of the cipher text in the array.java.io.IOException
protected int checkPaddingConstantTime(byte[] buf, int off, int len, int blockSize, int macSize)
protected int chooseExtraPadBlocks(java.security.SecureRandom r, int max)
protected int lowestBitSet(int x)