-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Recently,I need to write EAP-TTLS's server, my company used BounyCastle to implement PEAP'server、TLS's server. During the development of TTLS, i find that i back a accept packet, but ac show the "authentication fail". I checked packet 、username、password,but nothing exception.
I doubt material key has some of problems.
E is there any special difference between TTLS and PEAP in the handshake phase when using Bouncy Castle, except for generating the label of the key material and the client_random and server_random's order.,
This my implement: in notifyHandshakeComplete()
public static MPPEKeys deriveMPPEKeysByTlsContext(TlsContext tlsContext , AccessRequest accessRequest) { MPPEKeys derivedMPPEKeys = new MPPEKeys(); byte[] keyMaterial = null; if (TLS_VER_10.equals(tlsContext.getClientVersion().getName())) { keyMaterial = exportKeyingMaterial(ExporterLabel.ttls_keying_material, null, 64, tlsContext.getSecurityParametersConnection() , null); } else { keyMaterial = tlsContext.exportKeyingMaterial(ExporterLabel.ttls_keying_material, null, 128); } byte[] recvKey = new byte[32]; byte[] sendKey = new byte[32]; System.arraycopy(keyMaterial, 0, recvKey, 0, 32); System.arraycopy(keyMaterial, 32, sendKey, 0, 32); derivedMPPEKeys.setRecvKey(recvKey); derivedMPPEKeys.setSendKey(sendKey); return derivedMPPEKeys; }