public abstract class CipherSuite
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private byte[] |
m_ciphersuitecode |
protected java.lang.String |
m_ciphersuitename |
protected byte[] |
m_clientmacsecret
client write mac secret
|
protected byte[] |
m_clientwriteIV
client write IV, only used for block ciphers
|
protected byte[] |
m_clientwritekey
client write key
|
protected mybouncycastle.org.bouncycastle.crypto.modes.CBCBlockCipher |
m_decryptcipher |
protected mybouncycastle.org.bouncycastle.crypto.modes.CBCBlockCipher |
m_encryptcipher |
private mybouncycastle.org.bouncycastle.crypto.macs.HMac |
m_hmacInput |
private mybouncycastle.org.bouncycastle.crypto.macs.HMac |
m_hmacOutput |
private Key_Exchange |
m_keyexchangealgorithm |
private MyRandom |
m_Random |
protected long |
m_readsequenznumber
readsequenznumber for packages
|
private JAPCertificate |
m_servercertificate |
protected byte[] |
m_servermacsecret
server write mac secret
|
protected byte[] |
m_serverwriteIV
server write IV, only used for block ciphers
|
protected byte[] |
m_serverwritekey
server write key
|
protected long |
m_writesequenznumber
writesequenznumber for packages
|
Constructor and Description |
---|
CipherSuite(byte[] code)
Constructor for a ciphersuite
|
Modifier and Type | Method and Description |
---|---|
byte[] |
calculateClientKeyExchange()
calculate the client keys (see RFC2246 Client Key Exchange)
|
protected abstract void |
calculateKeys(byte[] keys,
boolean forclient)
calculate server and client write keys (see RFC2246 TLS Record Protocoll)
|
void |
decode(TLSPlaintextRecord msg)
decodes a message with a symmetric key
|
void |
encode(TLSPlaintextRecord msg)
encodes a message with a symmetric key
|
byte[] |
getCipherSuiteCode()
returns the code of a ciphersuite (see RFC2246)
|
Key_Exchange |
getKeyExchangeAlgorithm()
gets the key exchange algorithm that is used
|
void |
processClientKeyExchange(java.math.BigInteger dh_y)
processes the client key exchange
|
void |
processServerFinished(TLSPlaintextRecord msg,
byte[] handshakemessages)
validates the finishedmessage and throws a Exception if a error occure
|
protected void |
setKeyExchangeAlgorithm(Key_Exchange ke)
sets the key exchange algorithm
|
void |
setServerCertificate(JAPCertificate cert)
set the Server Certificate
|
java.lang.String |
toString() |
private byte[] m_ciphersuitecode
protected java.lang.String m_ciphersuitename
private Key_Exchange m_keyexchangealgorithm
private JAPCertificate m_servercertificate
protected mybouncycastle.org.bouncycastle.crypto.modes.CBCBlockCipher m_decryptcipher
protected mybouncycastle.org.bouncycastle.crypto.modes.CBCBlockCipher m_encryptcipher
private mybouncycastle.org.bouncycastle.crypto.macs.HMac m_hmacInput
private mybouncycastle.org.bouncycastle.crypto.macs.HMac m_hmacOutput
private MyRandom m_Random
protected long m_writesequenznumber
protected long m_readsequenznumber
protected byte[] m_clientwritekey
protected byte[] m_clientmacsecret
protected byte[] m_clientwriteIV
protected byte[] m_serverwritekey
protected byte[] m_servermacsecret
protected byte[] m_serverwriteIV
public CipherSuite(byte[] code) throws TLSException
code
- Code of the ciphersuite (see RFC2246)TLSException
protected void setKeyExchangeAlgorithm(Key_Exchange ke)
ke
- Key Exchange Algorithmpublic Key_Exchange getKeyExchangeAlgorithm()
public void setServerCertificate(JAPCertificate cert)
cert
- server certificatepublic byte[] getCipherSuiteCode()
public void processClientKeyExchange(java.math.BigInteger dh_y)
dh_y
- diffie hellman parameterpublic byte[] calculateClientKeyExchange() throws TLSException
TLSException
public void processServerFinished(TLSPlaintextRecord msg, byte[] handshakemessages) throws TLSException
finishedmessage
- the message that have to be validetedTLSException
public void encode(TLSPlaintextRecord msg)
message
- messagepublic void decode(TLSPlaintextRecord msg) throws TLSException
message
- messageTLSException
protected abstract void calculateKeys(byte[] keys, boolean forclient)
keys
- array of bytes(see RFC how it is calculated)public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2023. All rights reserved.