public class PasswordEncryptor
extends java.lang.Object
Generates LanMan and NTLMv1 encrypted passwords from the plain text password and challenge key.
| Modifier and Type | Field and Description |
|---|---|
static int |
LANMAN |
static int |
MD4 |
static int |
NTLM1 |
static int |
NTLM2 |
| Constructor and Description |
|---|
PasswordEncryptor()
Default constructor
|
| Modifier and Type | Method and Description |
|---|---|
static boolean |
checkEncryptionAlgorithms()
Check if the required algorithms are available
|
byte[] |
doLanManBaseEncryption(java.lang.String pwd)
LanMan first stage of the encryption
|
byte[] |
doLanManEncryption(byte[] p21,
byte[] c8)
LanMan encryption of a password previously encrypted with the well known value
|
byte[] |
doMD4Hashing(byte[] pwdBytes)
MD4 password hashinh
|
byte[] |
doNTLM1Encryption(byte[] p21,
byte[] c8)
NTLM1 encryption of the MD4 hashed password
|
byte[] |
doNTLM2Encryption(byte[] md4Hash,
java.lang.String userName,
java.lang.String domain)
NTLM2 encryption of the MD4 hashed password
|
byte[] |
generateEncryptedPassword(java.lang.String plainPwd,
byte[] encryptKey,
int alg,
java.lang.String userName,
java.lang.String domain)
Encrypt the plain text password with the specified encryption key using the specified
encryption algorithm.
|
static java.lang.String |
getAlgorithmName(int alg)
Return the encryption algorithm as a string
|
byte[] |
P16(java.lang.String pwd,
byte[] s8)
P16 encryption
|
public static final int LANMAN
public static final int NTLM1
public static final int NTLM2
public static final int MD4
public static final boolean checkEncryptionAlgorithms()
public byte[] generateEncryptedPassword(java.lang.String plainPwd,
byte[] encryptKey,
int alg,
java.lang.String userName,
java.lang.String domain)
throws java.security.NoSuchAlgorithmException,
java.security.InvalidKeyException
plainPwd - Plaintext password stringencryptKey - byte[] Encryption keyalg - int Encryption algorithmuserName - Stringdomain - Stringjava.security.NoSuchAlgorithmException - If a required encryption algorithm is not availablejava.security.InvalidKeyException - Key is invalidpublic final byte[] P16(java.lang.String pwd,
byte[] s8)
throws java.security.NoSuchAlgorithmException
pwd - java.lang.Strings8 - byte[]java.security.NoSuchAlgorithmException - If a required encryption algorithm is not availablepublic static java.lang.String getAlgorithmName(int alg)
alg - intpublic final byte[] doNTLM1Encryption(byte[] p21,
byte[] c8)
throws java.security.NoSuchAlgorithmException
p21 - byte[]c8 - byte[]java.security.NoSuchAlgorithmExceptionpublic final byte[] doNTLM2Encryption(byte[] md4Hash,
java.lang.String userName,
java.lang.String domain)
throws java.security.NoSuchAlgorithmException,
java.security.InvalidKeyException
md4Hash - byte[]userName - Stringdomain - Stringjava.security.NoSuchAlgorithmExceptionjava.security.InvalidKeyExceptionpublic final byte[] doLanManBaseEncryption(java.lang.String pwd)
throws java.security.NoSuchAlgorithmException
pwd - Stringjava.security.NoSuchAlgorithmException - If a required encryption algorithm is not availablepublic final byte[] doLanManEncryption(byte[] p21,
byte[] c8)
throws java.security.NoSuchAlgorithmException
p21 - byte[]c8 - byte[]java.security.NoSuchAlgorithmExceptionpublic final byte[] doMD4Hashing(byte[] pwdBytes)
throws java.security.NoSuchAlgorithmException,
java.security.InvalidKeyException
pwdBytes - byte[]java.security.NoSuchAlgorithmExceptionjava.security.InvalidKeyExceptionCopyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.