Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

cryptix.sasl.srp
Class SRPClient  view SRPClient download SRPClient.java

java.lang.Object
  extended bycryptix.sasl.ClientMechanism
      extended bycryptix.sasl.srp.SRPClient
All Implemented Interfaces:
javax.security.sasl.SaslClient, javax.security.sasl.SaslClientExt, cryptix.sasl.SaslParams, SRPParams

public class SRPClient
extends cryptix.sasl.ClientMechanism
implements javax.security.sasl.SaslClientExt, SRPParams, cryptix.sasl.SaslParams

The Cryptix implementation of an SM2-capable client-side SASL-SRP mechanism.

Since:
draft-burdis-cat-sasl-srp-04, draft-naffah-cat-sasl-sm2-00
Version:
$Revision: 1.10 $

Field Summary
private  java.math.BigInteger A
           
private static org.apache.log4j.Category cat
           
private  java.lang.String chosenConfidentialityAlgorithm
           
private  java.lang.String chosenIntegrityAlgorithm
           
private  java.math.BigInteger g
           
private  CALG inCipher
           
private  int inCounter
           
private  IALG inMac
           
private  javax.crypto.SecretKey K
           
private  java.security.KeyPair kp
           
private  java.lang.String L
           
private  byte[] M1
           
private  java.math.BigInteger N
           
private  java.lang.String o
           
private  CALG outCipher
           
private  int outCounter
           
private  IALG outMac
           
private  char[] password
           
private  int rawSendSize
           
private  boolean replayDetection
           
private  byte[] salt
           
private  SRP srp
           
private  java.lang.String U
           
 
Fields inherited from class cryptix.sasl.ClientMechanism
authorizationID, complete, handler, mechanism, properties, protocol, serverName, state
 
Fields inherited from interface cryptix.sasl.srp.SRPParams
AES, AVAILABLE_OPTIONS, BLOWFISH, CAST5, CHOSEN_OPTIONS, CLIENT_EVIDENCE, CLIENT_PUBLIC_KEY, CONFIDENTIALITY_ALGORITHMS, CONFIG_NDX_FIELD, DEFAULT_CONFIDENTIALITY, DEFAULT_INTEGRITY, DEFAULT_MANDATORY, DEFAULT_PASSWORD_FILE, DEFAULT_REPLAY_DETECTION, FIELD_GENERATOR, HMAC_MD5, HMAC_SHA1, INTEGRITY_ALGORITHMS, MANDATORY_CONFIDENTIALITY, MANDATORY_INTEGRITY, MANDATORY_NONE, MANDATORY_REPLAY_DETECTION, MD_NAME_FIELD, PASSWORD_FILE, PASSWORD_VERIFIER, SALT_FIELD, SERVER_EVIDENCE, SERVER_PUBLIC_KEY, SHARED_MODULUS, SRP_CONFIDENTIALITY, SRP_DEFAULT_DIGEST_NAME, SRP_DIGEST_NAME, SRP_INTEGRITY_PROTECTION, SRP_MANDATORY, SRP_MD5_NAME, SRP_REPLAY_DETECTION, SRP_RIPEMD_128_NAME, SRP_RIPEMD_160_NAME, SRP_SHA_160_NAME, SRP_SHA_256_NAME, SRP_SHA_384_NAME, SRP_SHA_512_NAME, SRP_SHA_NAME, SRP_SHA1_NAME, USER_NAME, USER_ROLE, USER_SALT, USER_VERIFIER_FIELD
 
Fields inherited from interface cryptix.sasl.SaslParams
AES_CALG, ANONYMOUS_MECHANISM, AUTH_INFO_PROVIDER_PKGS, BUFFER_LIMIT, CRAM_MD5_MECHANISM, FOUR_BYTE_HEADER_LIMIT, HMAC_MD5_IALG, HMAC_SHA_IALG, MD5_MDA, ONE_BYTE_HEADER_LIMIT, OTP_MECHANISM, PASSWORD, PLAIN_MECHANISM, RIJNDAEL_CALG, RIPEMD_160_MDA, SHA_MDA, SM2_MECHANISM, SRP_MECHANISM, TWO_BYTE_HEADER_LIMIT, TWOFISH_CALG, USERNAME
 
Constructor Summary
SRPClient(java.lang.String mdName, java.lang.String authorizationID, java.lang.String protocol, java.lang.String serverName, java.util.Hashtable props, javax.security.auth.callback.CallbackHandler cbh)
           
 
Method Summary
private  java.lang.String createOptionsList(java.lang.String availableOptionsList)
           
 void dispose()
          Disposes of any system resources or security-sensitive information the SaslClient might be using.
protected  byte[] engineUnwrap(byte[] incoming, int offset, int len)
           
protected  byte[] engineWrap(byte[] outgoing, int offset, int len)
           
 byte[] evaluateChallenge(byte[] challenge)
          Evaluates the challenge data and generates a response.
 byte[] evaluateEvidence(byte[] peerEvidence)
          Given the SASL mechanism peer's evidence, which may be null, this method is for SASL mechanisms capable of using the designated evidence to update or recycle their cryptographic data, so security services can still be provided, in a secure fashion, without the need to go through the authentication phase again.
protected  java.lang.String getNegotiatedQOP()
           
protected  java.lang.String getNegotiatedRawSendSize()
           
protected  java.lang.String getNegotiatedStrength()
           
 java.security.spec.AlgorithmParameterSpec getSaslSecurityContext()
          Retrieves the SASL Security Context of this SASL mechanism object.
private  void getUsernameAndPassword()
           
 boolean hasInitialResponse()
          Determines if this mechanism has an optional initial response.
private  byte[] sendEvidence(byte[] input)
           
private  byte[] sendIdentity()
           
private  byte[] sendRequest(byte[] input)
           
 void setSaslSecurityContext(java.security.spec.AlgorithmParameterSpec ctx)
          Sets the SASL Security Context of this SASL mechanism object to the designated value.
private  void setupSecurityServices()
           
private  byte[] verifyEvidence(byte[] input)
           
 
Methods inherited from class cryptix.sasl.ClientMechanism
getAuthorizationID, getMechanismName, getNegotiatedMaxBuffer, getNegotiatedPolicyForwardSecrecy, getNegotiatedPolicyNoActive, getNegotiatedPolicyNoAnonymous, getNegotiatedPolicyNoDictionary, getNegotiatedPolicyNoPlainText, getNegotiatedPolicyPassCredentials, getNegotiatedProperty, getNegotiatedServerAuth, isComplete, unwrap, wrap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.security.sasl.SaslClient
getMechanismName, getNegotiatedProperty, isComplete, unwrap, wrap
 

Field Detail

cat

private static org.apache.log4j.Category cat

U

private java.lang.String U

salt

private byte[] salt

password

private char[] password

M1

private byte[] M1

L

private java.lang.String L

o

private java.lang.String o

chosenIntegrityAlgorithm

private java.lang.String chosenIntegrityAlgorithm

chosenConfidentialityAlgorithm

private java.lang.String chosenConfidentialityAlgorithm

rawSendSize

private int rawSendSize

kp

private java.security.KeyPair kp

A

private java.math.BigInteger A

N

private java.math.BigInteger N

g

private java.math.BigInteger g

srp

private SRP srp

K

private javax.crypto.SecretKey K

replayDetection

private boolean replayDetection

inCounter

private int inCounter

outCounter

private int outCounter

inMac

private IALG inMac

outMac

private IALG outMac

inCipher

private CALG inCipher

outCipher

private CALG outCipher
Constructor Detail

SRPClient

public SRPClient(java.lang.String mdName,
                 java.lang.String authorizationID,
                 java.lang.String protocol,
                 java.lang.String serverName,
                 java.util.Hashtable props,
                 javax.security.auth.callback.CallbackHandler cbh)
Method Detail

getSaslSecurityContext

public java.security.spec.AlgorithmParameterSpec getSaslSecurityContext()
                                                                 throws javax.security.sasl.SaslException
Description copied from interface: javax.security.sasl.SaslClientExt
Retrieves the SASL Security Context of this SASL mechanism object. This method can be called only after the authentication exchange has completed (i.e., when SaslClient.isComplete()>SaslClient.isComplete() 55 returns true); otherwise, a javax.security.sasl.SaslException is thrown.

Specified by:
getSaslSecurityContext in interface javax.security.sasl.SaslClientExt

setSaslSecurityContext

public void setSaslSecurityContext(java.security.spec.AlgorithmParameterSpec ctx)
                            throws javax.security.sasl.SaslException
Description copied from interface: javax.security.sasl.SaslClientExt
Sets the SASL Security Context of this SASL mechanism object to the designated value.

Specified by:
setSaslSecurityContext in interface javax.security.sasl.SaslClientExt

evaluateEvidence

public byte[] evaluateEvidence(byte[] peerEvidence)
                        throws javax.security.sasl.SaslException
Description copied from interface: javax.security.sasl.SaslClientExt
Given the SASL mechanism peer's evidence, which may be null, this method is for SASL mechanisms capable of using the designated evidence to update or recycle their cryptographic data, so security services can still be provided, in a secure fashion, without the need to go through the authentication phase again.

Specified by:
evaluateEvidence in interface javax.security.sasl.SaslClientExt

hasInitialResponse

public boolean hasInitialResponse()
Description copied from interface: javax.security.sasl.SaslClient
Determines if this mechanism has an optional initial response. If true, caller should call SaslClient.evaluateChallenge(byte[])>SaslClient.evaluateChallenge(byte[]) 55 with an empty array to get the initial response.

Specified by:
hasInitialResponse in interface javax.security.sasl.SaslClient

evaluateChallenge

public byte[] evaluateChallenge(byte[] challenge)
                         throws javax.security.sasl.SaslException
Description copied from interface: javax.security.sasl.SaslClient
Evaluates the challenge data and generates a response. If a challenge is received from the server during the authentication process, this method is called to prepare an appropriate next response to submit to the server.

Specified by:
evaluateChallenge in interface javax.security.sasl.SaslClient

engineUnwrap

protected byte[] engineUnwrap(byte[] incoming,
                              int offset,
                              int len)
                       throws javax.security.sasl.SaslException

engineWrap

protected byte[] engineWrap(byte[] outgoing,
                            int offset,
                            int len)
                     throws javax.security.sasl.SaslException

dispose

public void dispose()
             throws javax.security.sasl.SaslException
Description copied from interface: javax.security.sasl.SaslClient
Disposes of any system resources or security-sensitive information the SaslClient might be using. Invoking this method invalidates the SaslClient instance. This method is idempotent.

Specified by:
dispose in interface javax.security.sasl.SaslClient

getNegotiatedQOP

protected java.lang.String getNegotiatedQOP()

getNegotiatedStrength

protected java.lang.String getNegotiatedStrength()

getNegotiatedRawSendSize

protected java.lang.String getNegotiatedRawSendSize()

sendIdentity

private byte[] sendIdentity()
                     throws javax.security.sasl.SaslException

sendRequest

private byte[] sendRequest(byte[] input)
                    throws javax.security.sasl.SaslException

sendEvidence

private byte[] sendEvidence(byte[] input)
                     throws javax.security.sasl.SaslException

verifyEvidence

private byte[] verifyEvidence(byte[] input)
                       throws javax.security.sasl.SaslException

getUsernameAndPassword

private void getUsernameAndPassword()
                             throws javax.security.sasl.SaslException

createOptionsList

private java.lang.String createOptionsList(java.lang.String availableOptionsList)
                                    throws javax.security.sasl.SaslException

setupSecurityServices

private void setupSecurityServices()
                            throws javax.security.sasl.SaslException