org.bouncycastle.crypto.tls
Class TlsBlockCipher
java.lang.Object
org.bouncycastle.crypto.tls.TlsBlockCipher
- All Implemented Interfaces:
- TlsCipher
public class TlsBlockCipher
- extends java.lang.Object
- implements TlsCipher
A generic TLS 1.0 / SSLv3 block cipher.
This can be used for AES or 3DES for example.
Method Summary |
protected int |
chooseExtraPadBlocks(java.security.SecureRandom r,
int max)
|
byte[] |
decodeCiphertext(short type,
byte[] ciphertext,
int offset,
int len)
|
byte[] |
encodePlaintext(short type,
byte[] plaintext,
int offset,
int len)
|
TlsMac |
getReadMac()
|
TlsMac |
getWriteMac()
|
protected void |
initCipher(boolean forEncryption,
BlockCipher cipher,
byte[] key_block,
int key_size,
int key_offset,
int iv_offset)
|
protected int |
lowestBitSet(int x)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
context
protected TlsClientContext context
encryptCipher
protected BlockCipher encryptCipher
decryptCipher
protected BlockCipher decryptCipher
writeMac
protected TlsMac writeMac
readMac
protected TlsMac readMac
TlsBlockCipher
public TlsBlockCipher(TlsClientContext context,
BlockCipher encryptCipher,
BlockCipher decryptCipher,
Digest writeDigest,
Digest readDigest,
int cipherKeySize)
getWriteMac
public TlsMac getWriteMac()
getReadMac
public TlsMac getReadMac()
initCipher
protected void initCipher(boolean forEncryption,
BlockCipher cipher,
byte[] key_block,
int key_size,
int key_offset,
int iv_offset)
encodePlaintext
public byte[] encodePlaintext(short type,
byte[] plaintext,
int offset,
int len)
- Specified by:
encodePlaintext
in interface TlsCipher
decodeCiphertext
public byte[] decodeCiphertext(short type,
byte[] ciphertext,
int offset,
int len)
throws java.io.IOException
- Specified by:
decodeCiphertext
in interface TlsCipher
- Throws:
java.io.IOException
chooseExtraPadBlocks
protected int chooseExtraPadBlocks(java.security.SecureRandom r,
int max)
lowestBitSet
protected int lowestBitSet(int x)