APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.sun.security.sasl.digest

pack-priv abstract Class DigestMD5Base

extends AbstractSaslImpl
Class Inheritance
Known Direct Subclasses
com.sun.security.sasl.digest.DigestMD5Client, com.sun.security.sasl.digest.DigestMD5Server
Imports
java.io.ByteArrayOutputStream, .IOException, java.math.BigInteger, java.nio.charset.Charset, java.util.Map, .Arrays, .List, java.util.logging.Level, java.security.MessageDigest, .NoSuchAlgorithmException, .InvalidKeyException, .SecureRandom, .InvalidAlgorithmParameterException, java.security.spec.KeySpec, .InvalidKeySpecException, javax.crypto.Cipher, .SecretKey, .Mac, .SecretKeyFactory, .NoSuchPaddingException, .IllegalBlockSizeException, javax.crypto.spec.IvParameterSpec, .SecretKeySpec, .DESKeySpec, .DESedeKeySpec, javax.security.auth.callback.CallbackHandler, javax.security.sasl.*, com.sun.security.sasl.util.AbstractSaslImpl, sun.security.jca.JCAUtil

Utility class for DIGEST-MD5 mechanism. Provides utility methods and contains two inner classes which implement the SecurityCtx interface. The inner classes provide the functionality to allow for quality-of-protection (QOP) with integrity checking and privacy.
Authors
Jonathan Bruce, Rosanna Lee

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class
DigestMD5Base.DigestIntegrity

Implementation of the SecurityCtx interface allowing for messages between the client and server to be integrity checked.

pack-priv class
DigestMD5Base.DigestPrivacy

Implementation of the SecurityCtx interface allowing for messages between the client and server to be integrity checked and encrypted.

Field Summary

Modifier and TypeField and Description
protected String
protected CallbackHandler
protected static final byte[]
protected static final String[]
protected static final int
protected static final int
protected static final int
protected static final byte
protected static final byte
private static final String
protected String
private static final String
protected static final byte[]
private static final int
protected Charset
protected byte[]
private static final String[]
private static final BigInteger
protected static final int
protected static final int
protected String
protected String
protected String
protected String
protected byte[]
private static final char[]
pem_array

This array maps the characters to their 6 bit values

private static final int
protected static final int
protected static final int
protected static final byte
protected static final int
protected static final byte
protected static final byte
protected SecurityCtx
private static final SecureRandom
private static final String
protected int
protected static final byte
protected boolean
Inherited from com.sun.security.sasl.util.AbstractSaslImpl:
allQopcompletedHIGH_STRENGTHintegrityINTEGRITY_ONLY_PROTECTIONloggerLOW_STRENGTHMAX_SEND_BUFMEDIUM_STRENGTHmyClassNameNO_PROTECTIONprivacyPRIVACY_PROTECTIONqoprawSendSizerecvMaxBufSizesendMaxBufSizestrength

Constructor Summary

AccessConstructor and Description
protected
DigestMD5Base(Map<String, ?>
A map of property/value pairs
props
,
String
name of class to use for logging
className
,
int
number of first step in authentication state machine
firstStep
,
String
digestUri used in authentication
digestUri
,
CallbackHandler
callback handler used to get info required for auth
cbh
)

Constructs an instance of DigestMD5Base.

Method Summary

Modifier and TypeMethod and Description
private static byte[]
addDesParity(byte[] input, int offset, int len)

Expands a 7-byte array into an 8-byte array that contains parity bits The binary format of a cryptographic key is: (B1,B2,...,B7,P1,B8,...B14,P2,B15,...,B49,P7,B50,...,B56,P8) where (B1,B2,...,B56) are the independent bits of a DES key and (PI,P2,...,P8) are reserved for parity bits computed on the preceding seven independent bits and set so that the parity of the octet is odd, i.e., there is an odd number of "1" bits in the octet.

protected byte[]

Returns:

a non-null String contain the HEX value
binaryToHex
(byte[] digest)

Convert a byte array to hexadecimal string.

public void
private static void
extractDirective(String
A non-null String challenge token name.
key
,
byte[]
A non-null String token value.
value
,
String[] keyTable, byte[][] valueTable, List<byte[]> realmChoices, int realmIndex)

Processes directive/value pairs from the digest-challenge and fill out the challengeVal array.

protected static final byte[]
protected byte[]

Returns:

A non-null byte array containing the repsonse-value.
generateResponseValue
(String
"AUTHENTICATE" for client-generated response; "" for server-generated response
authMethod
,
String digestUriValue, String qopValue, String usernameValue, String realmValue, char[] passwdValue, byte[] nonceValue, byte[] cNonceValue, int nonceCount, byte[] authzidValue)

Assembles response-value for digest-response.

public String

Returns:

The String "DIGEST-MD5"
getMechanismName
()

Retrieves the SASL mechanism IANA name.

public Object
protected static byte[]
private static boolean
isLws(byte b)

private static SecretKey

Returns:

SecretKey An instance of either DESKeySpec or DESedeKeySpec.
makeDesKeys
(byte[]
A non-null byte array containing key material for DES / DESede.
input
,
String
A string specifying eithe a DES or a DESede key.
desStrength
)

Create parity-adjusted keys suitable for DES / DESede encryption.

private static boolean
private static boolean
needEscape(char ch)

protected static String

Returns:

A non-null String representing the current NONCE-COUNT
nonceCountToHex
(int count)

Takes 'nonceCount' value and returns HEX value of the value.

protected static byte[][]
parseDirectives(byte[]
A non-null digest-challenge string.
buf
,
String[] keyTable, List<byte[]> realmChoices, int realmIndex)

Parses digest-challenge string, extracting each token and value(s)

protected static String
private static void
setParityBit(byte[] key)

Sets the parity bit (0th bit) in each byte so that each byte contains an odd number of 1's.

private static int
skipLws(byte[] buf, int start)

protected byte[]

Returns:

a non-null byte array containing the correct character encoding for username, paswd or realm.
stringToByte_8859_1
(String str)

Used to convert username-value, passwd or realm to 8859_1 encoding if all chars in string are within the 8859_1 (Latin 1) encoding range.

public byte[]

Returns:

The unwrapped message according to either the integrity or privacy quality-of-protection specifications.
unwrap
(byte[]
The byte array containing the incoming bytes.
incoming
,
int
The offset from which to read the byte array.
start
,
int
The number of bytes to read from the offset.
len
)

Unwrap the incoming message using the wrap method of the secCtx object instance.

public byte[]

Returns:

The wrapped message according to either the integrity or privacy quality-of-protection specifications.
wrap
(byte[]
The byte array containing the outgoing bytes.
outgoing
,
int
The offset from which to read the byte array.
start
,
int
The number of bytes to read from the offset.
len
)

Wrap outgoing bytes using the wrap method of the secCtx object instance.

protected static void
writeQuotedStringValue(ByteArrayOutputStream out, byte[] buf)

Checks if a byte[] contains characters that must be quoted and write the resulting, possibly escaped, characters to out.

Inherited from com.sun.security.sasl.util.AbstractSaslImpl:
combineMasksfindPreferredMaskintToNetworkByteOrderisCompletenetworkByteOrderToIntparseQoptraceOutputtraceOutput

Field Detail

authzidback to summary
protected String authzid
cbhback to summary
protected CallbackHandler cbh
CIPHER_MASKSback to summary
protected static final byte[] CIPHER_MASKS
CIPHER_TOKENSback to summary
protected static final String[] CIPHER_TOKENS
DEFAULT_MAXBUFback to summary
protected static final int DEFAULT_MAXBUF
DESback to summary
protected static final int DES
DES3back to summary
protected static final int DES3
DES_3_STRENGTHback to summary
protected static final byte DES_3_STRENGTH
DES_STRENGTHback to summary
protected static final byte DES_STRENGTH
DI_CLASS_NAMEback to summary
private static final String DI_CLASS_NAME
digestUriback to summary
protected String digestUri
DP_CLASS_NAMEback to summary
private static final String DP_CLASS_NAME
EMPTY_BYTE_ARRAYback to summary
protected static final byte[] EMPTY_BYTE_ARRAY
ENCODED_NONCE_SIZEback to summary
private static final int ENCODED_NONCE_SIZE
encodingback to summary
protected Charset encoding
H_A1back to summary
protected byte[] H_A1
JCE_CIPHER_NAMEback to summary
private static final String[] JCE_CIPHER_NAME
MASKback to summary
private static final BigInteger MASK
MAX_CHALLENGE_LENGTHback to summary
protected static final int MAX_CHALLENGE_LENGTH
MAX_RESPONSE_LENGTHback to summary
protected static final int MAX_RESPONSE_LENGTH
negotiatedCipherback to summary
protected String negotiatedCipher
negotiatedQopback to summary
protected String negotiatedQop
negotiatedRealmback to summary
protected String negotiatedRealm
negotiatedStrengthback to summary
protected String negotiatedStrength
nonceback to summary
protected byte[] nonce
pem_arrayback to summary
private static final char[] pem_array

This array maps the characters to their 6 bit values

RAW_NONCE_SIZEback to summary
private static final int RAW_NONCE_SIZE
RC4back to summary
protected static final int RC4
RC4_40back to summary
protected static final int RC4_40
RC4_40_STRENGTHback to summary
protected static final byte RC4_40_STRENGTH
RC4_56back to summary
protected static final int RC4_56
RC4_56_STRENGTHback to summary
protected static final byte RC4_56_STRENGTH
RC4_STRENGTHback to summary
protected static final byte RC4_STRENGTH
secCtxback to summary
protected SecurityCtx secCtx
SECURE_RANDOMback to summary
private static final SecureRandom SECURE_RANDOM
SECURITY_LAYER_MARKERback to summary
private static final String SECURITY_LAYER_MARKER
stepback to summary
protected int step
UNSETback to summary
protected static final byte UNSET
useUTF8back to summary
protected boolean useUTF8

Constructor Detail

DigestMD5Baseback to summary
protected DigestMD5Base(Map<String, ?> props, String className, int firstStep, String digestUri, CallbackHandler cbh) throws SaslException

Constructs an instance of DigestMD5Base. Calls super constructor to parse properties for mechanism.

Parameters
props:Map<String, ?>

A map of property/value pairs

className:String

name of class to use for logging

firstStep:int

number of first step in authentication state machine

digestUri:String

digestUri used in authentication

cbh:CallbackHandler

callback handler used to get info required for auth

Exceptions
SaslException:
If invalid value found in props.

Method Detail

addDesParityback to summary
private static byte[] addDesParity(byte[] input, int offset, int len)

Expands a 7-byte array into an 8-byte array that contains parity bits The binary format of a cryptographic key is: (B1,B2,...,B7,P1,B8,...B14,P2,B15,...,B49,P7,B50,...,B56,P8) where (B1,B2,...,B56) are the independent bits of a DES key and (PI,P2,...,P8) are reserved for parity bits computed on the preceding seven independent bits and set so that the parity of the octet is odd, i.e., there is an odd number of "1" bits in the octet.

binaryToHexback to summary
protected byte[] binaryToHex(byte[] digest)

Convert a byte array to hexadecimal string.

Returns:byte[]

a non-null String contain the HEX value

disposeback to summary
public void dispose() throws SaslException
extractDirectiveback to summary
private static void extractDirective(String key, byte[] value, String[] keyTable, byte[][] valueTable, List<byte[]> realmChoices, int realmIndex) throws SaslException

Processes directive/value pairs from the digest-challenge and fill out the challengeVal array.

Parameters
key:String

A non-null String challenge token name.

value:byte[]

A non-null String token value.

Exceptions
SaslException:
if a either the key or the value is null
generateNonceback to summary
protected static final byte[] generateNonce()
generateResponseValueback to summary
protected byte[] generateResponseValue(String authMethod, String digestUriValue, String qopValue, String usernameValue, String realmValue, char[] passwdValue, byte[] nonceValue, byte[] cNonceValue, int nonceCount, byte[] authzidValue) throws NoSuchAlgorithmException, IOException

Assembles response-value for digest-response.

Parameters
authMethod:String

"AUTHENTICATE" for client-generated response; "" for server-generated response

Returns:byte[]

A non-null byte array containing the repsonse-value.

Exceptions
NoSuchAlgorithmException:
if the platform does not have MD5 digest support.
IOException:
if an error occurs writing to the output byte array buffer.
getMechanismNameback to summary
public String getMechanismName()

Retrieves the SASL mechanism IANA name.

Returns:String

The String "DIGEST-MD5"

getNegotiatedPropertyback to summary
public Object getNegotiatedProperty(String propName)

Overrides com.sun.security.sasl.util.AbstractSaslImpl.getNegotiatedProperty.

Doc from com.sun.security.sasl.util.AbstractSaslImpl.getNegotiatedProperty.

Retrieves the negotiated property.

getPlatformCiphersback to summary
protected static byte[] getPlatformCiphers()
isLwsback to summary
private static boolean isLws(byte b)
makeDesKeysback to summary
private static SecretKey makeDesKeys(byte[] input, String desStrength) throws NoSuchAlgorithmException, InvalidKeyException, InvalidKeySpecException

Create parity-adjusted keys suitable for DES / DESede encryption.

Parameters
input:byte[]

A non-null byte array containing key material for DES / DESede.

desStrength:String

A string specifying eithe a DES or a DESede key.

Returns:SecretKey

SecretKey An instance of either DESKeySpec or DESedeKeySpec.

Exceptions
NoSuchAlgorithmException:
if the either the DES or DESede algorithms cannote be lodaed by JCE.
InvalidKeyException:
if an invalid array of bytes is used as a key for DES or DESede.
InvalidKeySpecException:
in an invalid parameter is passed to either te DESKeySpec of the DESedeKeySpec constructors.
needEscapeback to summary
private static boolean needEscape(String str)
needEscapeback to summary
private static boolean needEscape(char ch)
nonceCountToHexback to summary
protected static String nonceCountToHex(int count)

Takes 'nonceCount' value and returns HEX value of the value.

Returns:String

A non-null String representing the current NONCE-COUNT

parseDirectivesback to summary
protected static byte[][] parseDirectives(byte[] buf, String[] keyTable, List<byte[]> realmChoices, int realmIndex) throws SaslException

Parses digest-challenge string, extracting each token and value(s)

Parameters
buf:byte[]

A non-null digest-challenge string.

Exceptions
SaslException:
if the buf cannot be parsed according to RFC 2831
quotedStringValueback to summary
protected static String quotedStringValue(String str)
setParityBitback to summary
private static void setParityBit(byte[] key)

Sets the parity bit (0th bit) in each byte so that each byte contains an odd number of 1's.

skipLwsback to summary
private static int skipLws(byte[] buf, int start)
stringToByte_8859_1back to summary
protected byte[] stringToByte_8859_1(String str)

Used to convert username-value, passwd or realm to 8859_1 encoding if all chars in string are within the 8859_1 (Latin 1) encoding range.

Returns:byte[]

a non-null byte array containing the correct character encoding for username, paswd or realm.

unwrapback to summary
public byte[] unwrap(byte[] incoming, int start, int len) throws SaslException

Unwrap the incoming message using the wrap method of the secCtx object instance.

Parameters
incoming:byte[]

The byte array containing the incoming bytes.

start:int

The offset from which to read the byte array.

len:int

The number of bytes to read from the offset.

Returns:byte[]

The unwrapped message according to either the integrity or privacy quality-of-protection specifications.

Exceptions
SaslException:
if an error occurs when unwrapping the incoming message
wrapback to summary
public byte[] wrap(byte[] outgoing, int start, int len) throws SaslException

Wrap outgoing bytes using the wrap method of the secCtx object instance.

Parameters
outgoing:byte[]

The byte array containing the outgoing bytes.

start:int

The offset from which to read the byte array.

len:int

The number of bytes to read from the offset.

Returns:byte[]

The wrapped message according to either the integrity or privacy quality-of-protection specifications.

Exceptions
SaslException:
if an error occurs when wrapping the outgoing message
writeQuotedStringValueback to summary
protected static void writeQuotedStringValue(ByteArrayOutputStream out, byte[] buf)

Checks if a byte[] contains characters that must be quoted and write the resulting, possibly escaped, characters to out.

com.sun.security.sasl.digest back to summary

pack-priv Class DigestMD5Base.DigestIntegrity

extends Object
implements SecurityCtx
Class Inheritance
All Implemented Interfaces
com.sun.security.sasl.digest.SecurityCtx
Known Direct Subclasses
com.sun.security.sasl.digest.DigestMD5Base.DigestPrivacy

Implementation of the SecurityCtx interface allowing for messages between the client and server to be integrity checked. After a successful DIGEST-MD5 authentication, integtrity checking is invoked if the SASL QOP (quality-of-protection) is set to 'auth-int'.

Further details on the integrity-protection mechanism can be found at section 2.3 - Integrity protection in the RFC2831 definition.

Author
Jonathan Bruce

Field Summary

Modifier and TypeField and Description
private static final String
protected final byte[]
protected byte[]
protected int
protected byte[]
protected int
protected final byte[]
private static final String

Constructor Summary

AccessConstructor and Description
pack-priv
DigestIntegrity(boolean clientMode)

Initializes DigestIntegrity implementation of SecurityCtx to enable DIGEST-MD5 integrity checking.

Method Summary

Modifier and TypeMethod and Description
private void
generateIntegrityKeyPair(boolean clientMode)

Generate client-server, server-client key pairs for DIGEST-MD5 integrity checking.

protected byte[]

Returns:

The MAC of a message.
getHMAC
(byte[]
A non-null byte array containing the key for the digest
Ki
,
byte[] seqnum, byte[]
The message to be digested
msg
,
int
The offset from which to read the msg byte array
start
,
int
The non-zero number of bytes to be read from the offset
len
)

Generates MAC to be appended onto out-going messages.

protected void
incrementSeqNum()

Increment own sequence number and set answer in NBO sequenceNum field.

public byte[]

Returns:

The verified message or null if integrity checking fails.
unwrap
(byte[]
A non-null byte array containing the incoming message.
incoming
,
int
The offset from which to read the byte array.
start
,
int
The non-zero number of bytes to read from the offset position.
len
)

Implements com.sun.security.sasl.digest.SecurityCtx.unwrap.

Return verified message without MAC - only if the received MAC and re-generated MAC are the same.

public byte[]

Returns:

The message including the integrity MAC
wrap
(byte[]
A non-null byte array containing the outgoing message.
outgoing
,
int
The offset from which to read the byte array.
start
,
int
The non-zero number of bytes for be read from the offset.
len
)

Implements com.sun.security.sasl.digest.SecurityCtx.wrap.

Append MAC onto outgoing message.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CLIENT_INT_MAGICback to summary
private static final String CLIENT_INT_MAGIC
messageTypeback to summary
protected final byte[] messageType
myKiback to summary
protected byte[] myKi
mySeqNumback to summary
protected int mySeqNum
peerKiback to summary
protected byte[] peerKi
peerSeqNumback to summary
protected int peerSeqNum
sequenceNumback to summary
protected final byte[] sequenceNum
SVR_INT_MAGICback to summary
private static final String SVR_INT_MAGIC

Constructor Detail

DigestIntegrityback to summary
pack-priv DigestIntegrity(boolean clientMode) throws SaslException

Initializes DigestIntegrity implementation of SecurityCtx to enable DIGEST-MD5 integrity checking.

Exceptions
SaslException:
if an error is encountered generating the key-pairs for integrity checking.

Method Detail

generateIntegrityKeyPairback to summary
private void generateIntegrityKeyPair(boolean clientMode) throws IOException, NoSuchAlgorithmException

Generate client-server, server-client key pairs for DIGEST-MD5 integrity checking.

Exceptions
IOException:
if an error occurs when writing to or from the byte array output buffers.
NoSuchAlgorithmException:
if the MD5 message digest algorithm cannot loaded.
getHMACback to summary
protected byte[] getHMAC(byte[] Ki, byte[] seqnum, byte[] msg, int start, int len) throws SaslException

Generates MAC to be appended onto out-going messages.

Parameters
Ki:byte[]

A non-null byte array containing the key for the digest

msg:byte[]

The message to be digested

start:int

The offset from which to read the msg byte array

len:int

The non-zero number of bytes to be read from the offset

Returns:byte[]

The MAC of a message.

Exceptions
SaslException:
if an error occurs when generating MAC.
incrementSeqNumback to summary
protected void incrementSeqNum()

Increment own sequence number and set answer in NBO sequenceNum field.

unwrapback to summary
public byte[] unwrap(byte[] incoming, int start, int len) throws SaslException

Implements com.sun.security.sasl.digest.SecurityCtx.unwrap.

Return verified message without MAC - only if the received MAC and re-generated MAC are the same.

Parameters
incoming:byte[]

A non-null byte array containing the incoming message.

start:int

The offset from which to read the byte array.

len:int

The non-zero number of bytes to read from the offset position.

Returns:byte[]

The verified message or null if integrity checking fails.

Exceptions
SaslException:
if an error is encountered converting a string into a UTF-8 byte encoding, or if the MD5 message digest algorithm cannot be found or if there is an error writing to the byte array output buffers
wrapback to summary
public byte[] wrap(byte[] outgoing, int start, int len) throws SaslException

Implements com.sun.security.sasl.digest.SecurityCtx.wrap.

Append MAC onto outgoing message.

Parameters
outgoing:byte[]

A non-null byte array containing the outgoing message.

start:int

The offset from which to read the byte array.

len:int

The non-zero number of bytes for be read from the offset.

Returns:byte[]

The message including the integrity MAC

Exceptions
SaslException:
if an error is encountered converting a string into a UTF-8 byte encoding, or if the MD5 message digest algorithm cannot be found or if there is an error writing to the byte array output buffers.
com.sun.security.sasl.digest back to summary

pack-priv final Class DigestMD5Base.DigestPrivacy

extends DigestIntegrity
implements SecurityCtx
Class Inheritance
All Implemented Interfaces
com.sun.security.sasl.digest.SecurityCtx

Implementation of the SecurityCtx interface allowing for messages between the client and server to be integrity checked and encrypted. After a successful DIGEST-MD5 authentication, privacy is invoked if the SASL QOP (quality-of-protection) is set to 'auth-conf'.

Further details on the integrity-protection mechanism can be found at section 2.4 - Confidentiality protection in RFC2831 definition.

Author
Jonathan Bruce

Field Summary

Modifier and TypeField and Description
private static final String
private Cipher
private Cipher
private static final String
Inherited from com.sun.security.sasl.digest.DigestMD5Base.DigestIntegrity:
messageTypemyKimySeqNumpeerKipeerSeqNumsequenceNum

Constructor Summary

AccessConstructor and Description
pack-priv
DigestPrivacy(boolean clientMode)

Initializes the cipher object instances for encryption and decryption.

Method Summary

Modifier and TypeMethod and Description
private void
generatePrivacyKeyPair(boolean clientMode)

Generates client-server and server-client keys to encrypt and decrypt messages.

public byte[]
unwrap(byte[] incoming, int start, int len)

Overrides com.sun.security.sasl.digest.DigestMD5Base.DigestIntegrity.unwrap.

Implements com.sun.security.sasl.digest.SecurityCtx.unwrap.

Unwrap incoming message and return original message

public byte[]

Returns:

The encrypted message.
wrap
(byte[]
A non-null byte array containing the outgoing message.
outgoing
,
int
The offset from which to read the byte array.
start
,
int
The non-zero number of bytes to be read from the offset.
len
)

Overrides com.sun.security.sasl.digest.DigestMD5Base.DigestIntegrity.wrap.

Implements com.sun.security.sasl.digest.SecurityCtx.wrap.

Encrypt out-going message.

Inherited from com.sun.security.sasl.digest.DigestMD5Base.DigestIntegrity:
getHMACincrementSeqNum

Field Detail

CLIENT_CONF_MAGICback to summary
private static final String CLIENT_CONF_MAGIC
decCipherback to summary
private Cipher decCipher
encCipherback to summary
private Cipher encCipher
SVR_CONF_MAGICback to summary
private static final String SVR_CONF_MAGIC

Constructor Detail

DigestPrivacyback to summary
pack-priv DigestPrivacy(boolean clientMode) throws SaslException

Initializes the cipher object instances for encryption and decryption.

Exceptions
SaslException:
if an error occurs with the Key initialization, or a string cannot be encoded into a byte array using the UTF-8 encoding, or an error occurs when writing to a byte array output buffers or the mechanism cannot load the MD5 message digest algorithm or invalid initialization parameters are passed to the cipher object instances.

Method Detail

generatePrivacyKeyPairback to summary
private void generatePrivacyKeyPair(boolean clientMode) throws IOException, NoSuchAlgorithmException, SaslException

Generates client-server and server-client keys to encrypt and decrypt messages. Also generates IVs for DES ciphers.

Exceptions
IOException:
if an error occurs when writing to or from the byte array output buffers.
NoSuchAlgorithmException:
if the MD5 message digest algorithm cannot loaded.
SaslException:
if an error occurs initializing the keys and IVs for the chosen cipher.
unwrapback to summary
public byte[] unwrap(byte[] incoming, int start, int len) throws SaslException

Overrides com.sun.security.sasl.digest.DigestMD5Base.DigestIntegrity.unwrap.

Implements com.sun.security.sasl.digest.SecurityCtx.unwrap.

Doc from com.sun.security.sasl.digest.SecurityCtx.unwrap.

Unwrap incoming message and return original message

Exceptions
SaslException:

Doc from com.sun.security.sasl.digest.DigestMD5Base.DigestIntegrity.unwrap.

if an error is encountered converting a string into a UTF-8 byte encoding, or if the MD5 message digest algorithm cannot be found or if there is an error writing to the byte array output buffers

wrapback to summary
public byte[] wrap(byte[] outgoing, int start, int len) throws SaslException

Overrides com.sun.security.sasl.digest.DigestMD5Base.DigestIntegrity.wrap.

Implements com.sun.security.sasl.digest.SecurityCtx.wrap.

Encrypt out-going message.

Parameters
outgoing:byte[]

A non-null byte array containing the outgoing message.

start:int

The offset from which to read the byte array.

len:int

The non-zero number of bytes to be read from the offset.

Returns:byte[]

The encrypted message.

Exceptions
SaslException:
if an error occurs when writing to or from the byte array output buffers or if the MD5 message digest algorithm cannot loaded or if an UTF-8 encoding is not supported on the platform.