01: package org.bouncycastle.crypto.tls;
02:
03: /**
04: * A NULL CipherSuite in java, this should only be used during handshake.
05: */
06: public class TlsNullCipherSuite extends TlsCipherSuite {
07:
08: protected void init(byte[] ms, byte[] cr, byte[] sr) {
09: throw new TlsRuntimeException(
10: "Sorry, init of TLS_NULL_WITH_NULL_NULL is forbidden");
11: }
12:
13: protected byte[] encodePlaintext(short type, byte[] plaintext,
14: int offset, int len) {
15: byte[] result = new byte[len];
16: System.arraycopy(plaintext, offset, result, 0, len);
17: return result;
18: }
19:
20: protected byte[] decodeCiphertext(short type, byte[] plaintext,
21: int offset, int len, TlsProtocolHandler handler) {
22: byte[] result = new byte[len];
23: System.arraycopy(plaintext, offset, result, 0, len);
24: return result;
25: }
26:
27: protected short getKeyExchangeAlgorithm() {
28: return 0;
29: }
30:
31: }
|