org.craft.atom.protocol.ssl
Class SslCodec

java.lang.Object
  extended by org.craft.atom.protocol.ssl.SslCodec

public class SslCodec
extends Object

A easy use class using the SSLEngine API to decrypt/encrypt data.

Version:
1.0, Oct 17, 2013
Author:
mindwind

Constructor Summary
SslCodec(SSLContext sslContext, SslHandshakeHandler sslHandler)
           
 
Method Summary
 byte[] decode(byte[] data)
          Decode for ssl encrypt data
 byte[] encode(byte[] data)
          Encode data to ssl encrypt data, must invoke this after handshake complete.
 void handshake()
          Initiate ssl handshake
 void init()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SslCodec

public SslCodec(SSLContext sslContext,
                SslHandshakeHandler sslHandler)
Method Detail

init

public void init()

decode

public byte[] decode(byte[] data)
Decode for ssl encrypt data

Parameters:
data -
Returns:
Only decrypt app data, the handshake data will write back to remote by SslHandshakeHandler

handshake

public void handshake()
Initiate ssl handshake


encode

public byte[] encode(byte[] data)
Encode data to ssl encrypt data, must invoke this after handshake complete.

Parameters:
data -
Returns:
Encrypt app data


Copyright © 2014. All Rights Reserved.