ClientKeyExchangepublic class ClientKeyExchange extends org.apache.harmony.xnet.provider.jsse.Message Represents client key exchange message |
Fields Summary |
---|
final byte[] | exchange_keysExchange keys | boolean | isTLSEquals true if TLS1.0 protocol is used | final boolean | isRSAEquals true if key exchange algorithm is RSA |
Constructors Summary |
---|
public ClientKeyExchange(byte[] encrypted_pre_master_secret, boolean isTLS)Creates outbound message
this.exchange_keys = encrypted_pre_master_secret;
length = this.exchange_keys.length;
if (isTLS) {
length += 2;
}
this.isTLS = isTLS;
isRSA = true;
| public ClientKeyExchange(BigInteger dh_Yc)Creates outbound message
byte[] bb = dh_Yc.toByteArray();
if (bb[0] == 0) {
exchange_keys = new byte[bb.length-1];
System.arraycopy(bb, 1, exchange_keys, 0, exchange_keys.length);
} else {
exchange_keys = bb;
}
length = exchange_keys.length +2;
isRSA = false;
| public ClientKeyExchange()Creates empty message
exchange_keys = new byte[0];
length = 0;
isRSA = false;
| public ClientKeyExchange(org.apache.harmony.xnet.provider.jsse.HandshakeIODataStream in, int length, boolean isTLS, boolean isRSA)Creates inbound message
this.isTLS = isTLS;
this.isRSA = isRSA;
if (length == 0) {
this.length = 0;
exchange_keys = new byte[0];
} else {
int size;
if (isRSA && !isTLS) {// SSL3.0 RSA
size = length;
this.length = size;
} else { // DH or TLSv1 RSA
size = in.readUint16();
this.length = 2 + size;
}
exchange_keys = new byte[size];
in.read(exchange_keys, 0, size);
if (this.length != length) {
fatalAlert(AlertProtocol.DECODE_ERROR, "DECODE ERROR: incorrect ClientKeyExchange");
}
}
|
Methods Summary |
---|
public int | getType()Returns message type
return Handshake.CLIENT_KEY_EXCHANGE;
| public boolean | isEmpty()Returns true if the message is empty (in case of implicit DH Yc)
return (exchange_keys.length == 0);
| public void | send(org.apache.harmony.xnet.provider.jsse.HandshakeIODataStream out)Sends message
if (exchange_keys.length != 0) {
if (!isRSA || isTLS) {// DH or TLSv1 RSA
out.writeUint16(exchange_keys.length);
}
out.write(exchange_keys);
}
|
|