final class DigestMD5Base.DigestPrivacy extends DigestMD5Base.DigestIntegrity implements SecurityCtx
Further details on the integrity-protection mechanism can be found at section 2.4 - Confidentiality protection in RFC2831 definition.
| Modifier and Type | Field and Description |
|---|---|
private static java.lang.String |
CLIENT_CONF_MAGIC |
private javax.crypto.Cipher |
decCipher |
private javax.crypto.Cipher |
encCipher |
private static java.lang.String |
SVR_CONF_MAGIC |
messageType, myKi, mySeqNum, peerKi, peerSeqNum, sequenceNum| Constructor and Description |
|---|
DigestPrivacy(boolean clientMode)
Initializes the cipher object instances for encryption and decryption.
|
| Modifier and Type | Method and Description |
|---|---|
private void |
generatePrivacyKeyPair(boolean clientMode)
Generates client-server and server-client keys to encrypt and
decrypt messages.
|
byte[] |
unwrap(byte[] incoming,
int start,
int len)
Return verified message without MAC - only if the received MAC
and re-generated MAC are the same.
|
byte[] |
wrap(byte[] outgoing,
int start,
int len)
Encrypt out-going message.
|
getHMAC, incrementSeqNumprivate static final java.lang.String CLIENT_CONF_MAGIC
private static final java.lang.String SVR_CONF_MAGIC
private javax.crypto.Cipher encCipher
private javax.crypto.Cipher decCipher
DigestPrivacy(boolean clientMode)
throws javax.security.sasl.SaslException
javax.security.sasl.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.private void generatePrivacyKeyPair(boolean clientMode)
throws java.io.IOException,
java.security.NoSuchAlgorithmException
java.io.IOException - if an error occurs when writing to or from the
byte array output buffers.java.security.NoSuchAlgorithmException - if the MD5 message digest algorithm
cannot loaded.java.io.UnsupportedEncodingException - if an UTF-8 encoding is not
supported on the platform.javax.security.sasl.SaslException - if an error occurs initializing the keys and
IVs for the chosen cipher.public byte[] wrap(byte[] outgoing,
int start,
int len)
throws javax.security.sasl.SaslException
wrap in interface SecurityCtxwrap in class DigestMD5Base.DigestIntegrityoutgoing - A non-null byte array containing the outgoing message.start - The offset from which to read the byte array.len - The non-zero number of bytes to be read from the offset.javax.security.sasl.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.public byte[] unwrap(byte[] incoming,
int start,
int len)
throws javax.security.sasl.SaslException
DigestMD5Base.DigestIntegrityunwrap in interface SecurityCtxunwrap in class DigestMD5Base.DigestIntegrityincoming - A non-null byte array containing the incoming
message.start - The offset from which to read the byte array.len - The non-zero number of bytes to read from the offset
position.javax.security.sasl.SaslException