Package tigase.auth.mechanisms
Class AbstractSaslSCRAM
- java.lang.Object
-
- tigase.auth.mechanisms.AbstractSasl
-
- tigase.auth.mechanisms.AbstractSaslSCRAM
-
- All Implemented Interfaces:
javax.security.sasl.SaslServer
- Direct Known Subclasses:
SaslSCRAM
,SaslSCRAMPlus
,SaslSCRAMSha256
,SaslSCRAMSha256Plus
,SaslSCRAMSha512
,SaslSCRAMSha512Plus
public abstract class AbstractSaslSCRAM extends AbstractSasl
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractSaslSCRAM.BindType
-
Field Summary
Fields Modifier and Type Field Description protected static byte[]
DEFAULT_CLIENT_KEY
protected static byte[]
DEFAULT_SERVER_KEY
static java.lang.String
LOCAL_CERTIFICATE_KEY
static java.lang.String
TLS_UNIQUE_ID_KEY
-
Fields inherited from class tigase.auth.mechanisms.AbstractSasl
authorizedId, callbackHandler, complete, log, negotiatedProperty, PASSWORD_NOT_VERIFIED_MSG, props, SASL_STRICT_MODE_KEY
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractSaslSCRAM(java.lang.String mechanismName, java.lang.String algorithm, byte[] clientKey, byte[] serverKey, java.util.Map<? super java.lang.String,?> props, javax.security.auth.callback.CallbackHandler callbackHandler)
protected
AbstractSaslSCRAM(java.lang.String mechanismName, java.lang.String algorithm, byte[] clientKey, byte[] serverKey, java.util.Map<? super java.lang.String,?> props, javax.security.auth.callback.CallbackHandler callbackHandler, java.lang.String serverOnce)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected byte[]
calculateC()
protected abstract void
checkRequestedBindType(AbstractSaslSCRAM.BindType requestedBindType)
byte[]
evaluateResponse(byte[] response)
java.lang.String
getAuthorizationID()
java.lang.String
getMechanismName()
protected byte[]
h(byte[] data)
static byte[]
hi(java.lang.String algorithm, byte[] password, byte[] salt, int iterations)
protected static byte[]
hmac(javax.crypto.SecretKey key, byte[] data)
protected javax.crypto.SecretKey
key(byte[] key)
static byte[]
normalize(java.lang.String str)
protected byte[]
processClientFirstMessage(byte[] data)
protected byte[]
processClientLastMessage(byte[] data)
byte[]
unwrap(byte[] incoming, int offset, int len)
protected void
validateBindingsData(AbstractSaslSCRAM.BindType requestedBindType, byte[] bindingData)
byte[]
wrap(byte[] outgoing, int offset, int len)
protected byte[]
xor(byte[] a, byte[] b)
-
Methods inherited from class tigase.auth.mechanisms.AbstractSasl
dispose, getNegotiatedProperty, handleCallbacks, isAuthzIDIgnored, isComplete, isEmpty, split
-
-
-
-
Field Detail
-
TLS_UNIQUE_ID_KEY
public static final java.lang.String TLS_UNIQUE_ID_KEY
- See Also:
- Constant Field Values
-
LOCAL_CERTIFICATE_KEY
public static final java.lang.String LOCAL_CERTIFICATE_KEY
- See Also:
- Constant Field Values
-
DEFAULT_CLIENT_KEY
protected static final byte[] DEFAULT_CLIENT_KEY
-
DEFAULT_SERVER_KEY
protected static final byte[] DEFAULT_SERVER_KEY
-
-
Constructor Detail
-
AbstractSaslSCRAM
protected AbstractSaslSCRAM(java.lang.String mechanismName, java.lang.String algorithm, byte[] clientKey, byte[] serverKey, java.util.Map<? super java.lang.String,?> props, javax.security.auth.callback.CallbackHandler callbackHandler)
-
AbstractSaslSCRAM
protected AbstractSaslSCRAM(java.lang.String mechanismName, java.lang.String algorithm, byte[] clientKey, byte[] serverKey, java.util.Map<? super java.lang.String,?> props, javax.security.auth.callback.CallbackHandler callbackHandler, java.lang.String serverOnce)
-
-
Method Detail
-
hi
public static byte[] hi(java.lang.String algorithm, byte[] password, byte[] salt, int iterations) throws java.security.InvalidKeyException, java.security.NoSuchAlgorithmException
- Throws:
java.security.InvalidKeyException
java.security.NoSuchAlgorithmException
-
hmac
protected static byte[] hmac(javax.crypto.SecretKey key, byte[] data) throws java.security.NoSuchAlgorithmException, java.security.InvalidKeyException
- Throws:
java.security.NoSuchAlgorithmException
java.security.InvalidKeyException
-
normalize
public static byte[] normalize(java.lang.String str)
-
calculateC
protected byte[] calculateC()
-
checkRequestedBindType
protected abstract void checkRequestedBindType(AbstractSaslSCRAM.BindType requestedBindType) throws javax.security.sasl.SaslException
- Throws:
javax.security.sasl.SaslException
-
evaluateResponse
public byte[] evaluateResponse(byte[] response) throws javax.security.sasl.SaslException
- Throws:
javax.security.sasl.SaslException
-
getAuthorizationID
public java.lang.String getAuthorizationID()
-
getMechanismName
public java.lang.String getMechanismName()
-
h
protected byte[] h(byte[] data) throws java.security.NoSuchAlgorithmException
- Throws:
java.security.NoSuchAlgorithmException
-
key
protected javax.crypto.SecretKey key(byte[] key)
-
processClientFirstMessage
protected byte[] processClientFirstMessage(byte[] data) throws javax.security.sasl.SaslException, java.security.InvalidKeyException, java.security.NoSuchAlgorithmException
- Throws:
javax.security.sasl.SaslException
java.security.InvalidKeyException
java.security.NoSuchAlgorithmException
-
processClientLastMessage
protected byte[] processClientLastMessage(byte[] data) throws javax.security.sasl.SaslException, java.security.InvalidKeyException, java.security.NoSuchAlgorithmException
- Throws:
javax.security.sasl.SaslException
java.security.InvalidKeyException
java.security.NoSuchAlgorithmException
-
unwrap
public byte[] unwrap(byte[] incoming, int offset, int len)
-
validateBindingsData
protected void validateBindingsData(AbstractSaslSCRAM.BindType requestedBindType, byte[] bindingData)
-
wrap
public byte[] wrap(byte[] outgoing, int offset, int len)
-
xor
protected byte[] xor(byte[] a, byte[] b)
-
-