package org.bouncycastle.crypto.tls;

public class SecurityParameters
{
    int entity = -1;
    int prfAlgorithm = -1;
    short compressionAlgorithm = -1;
    int verifyDataLength = -1;
    byte[] masterSecret = null;
    byte[] clientRandom = null;
    byte[] serverRandom = null;

    // TODO Keep this internal, since it's not the ideal place for it
    boolean truncatedHMac = false;

    /**
     * @return {@link ConnectionEnd}
     */
    public int getEntity()
    {
        return entity;
    }

    /**
     * @return {@link PRFAlgorithm}
     */
    public int getPrfAlgorithm()
    {
        return prfAlgorithm;
    }

    /**
     * @return {@link CompressionMethod}
     */
    public short getCompressionAlgorithm()
    {
        return compressionAlgorithm;
    }

    public int getVerifyDataLength()
    {
        return verifyDataLength;
    }

    public byte[] getMasterSecret()
    {
        return masterSecret;
    }

    public byte[] getClientRandom()
    {
        return clientRandom;
    }

    public byte[] getServerRandom()
    {
        return serverRandom;
    }
}

@@ -31,16 +31,54 @@
 o.tls;%0A%0A
+import org.bouncycastle.util.Arrays;%0A%0A
 public c
@@ -132,28 +132,27 @@
     int 
-prfAlgorithm
+cipherSuite
  = -1;%0A 
@@ -183,24 +183,51 @@
 rithm = -1;%0A
+    int prfAlgorithm = -1;%0A
     int veri
@@ -448,16 +448,582 @@
 false;%0A%0A
+    void copySessionParametersFrom(SecurityParameters other)%0A    %7B%0A        this.entity = other.entity;%0A        this.cipherSuite = other.cipherSuite;%0A        this.compressionAlgorithm = other.compressionAlgorithm;%0A        this.prfAlgorithm = other.prfAlgorithm;%0A        this.verifyDataLength = other.verifyDataLength;%0A        this.masterSecret = Arrays.clone(other.masterSecret);%0A    %7D%0A%0A    void clear()%0A    %7B%0A        if (this.masterSecret != null)%0A        %7B%0A            Arrays.fill(this.masterSecret, (byte)0);%0A            this.masterSecret = null;%0A        %7D%0A    %7D%0A%0A
     /**%0A
@@ -1164,20 +1164,19 @@
 ink 
-PRFAlgorithm
+CipherSuite
 %7D%0A  
@@ -1203,20 +1203,19 @@
  get
-PrfAlgorithm
+CipherSuite
 ()%0A 
@@ -1234,28 +1234,27 @@
  return 
-prfAlgorithm
+cipherSuite
 ;%0A    %7D%0A
@@ -1396,32 +1396,159 @@
 gorithm;%0A    %7D%0A%0A
+    /**%0A     * @return %7B@link PRFAlgorithm%7D%0A     */%0A    public int getPrfAlgorithm()%0A    %7B%0A        return prfAlgorithm;%0A    %7D%0A%0A
     public int g

Add new fields to support session resumption