public class PasswordEncryptor extends 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(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,
String userName,
String domain)
NTLM2 encryption of the MD4 hashed password
|
byte[] |
generateEncryptedPassword(String plainPwd,
byte[] encryptKey,
int alg,
String userName,
String domain)
Encrypt the plain text password with the specified encryption key using the specified
encryption algorithm.
|
static String |
getAlgorithmName(int alg)
Return the encryption algorithm as a string
|
byte[] |
P16(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(String plainPwd, byte[] encryptKey, int alg, String userName, String domain) throws NoSuchAlgorithmException, InvalidKeyException
plainPwd - Plaintext password stringencryptKey - byte[] Encryption keyalg - int Encryption algorithmuserName - Stringdomain - StringNoSuchAlgorithmException - If a required encryption algorithm is not availableInvalidKeyException - Key is invalidpublic final byte[] P16(String pwd, byte[] s8) throws NoSuchAlgorithmException
pwd - java.lang.Strings8 - byte[]NoSuchAlgorithmException - If a required encryption algorithm is not availablepublic static String getAlgorithmName(int alg)
alg - intpublic final byte[] doNTLM1Encryption(byte[] p21,
byte[] c8)
throws NoSuchAlgorithmException
p21 - byte[]c8 - byte[]NoSuchAlgorithmExceptionpublic final byte[] doNTLM2Encryption(byte[] md4Hash,
String userName,
String domain)
throws NoSuchAlgorithmException,
InvalidKeyException
md4Hash - byte[]userName - Stringdomain - StringNoSuchAlgorithmExceptionInvalidKeyExceptionpublic final byte[] doLanManBaseEncryption(String pwd) throws NoSuchAlgorithmException
pwd - StringNoSuchAlgorithmException - If a required encryption algorithm is not availablepublic final byte[] doLanManEncryption(byte[] p21,
byte[] c8)
throws NoSuchAlgorithmException
p21 - byte[]c8 - byte[]NoSuchAlgorithmExceptionpublic final byte[] doMD4Hashing(byte[] pwdBytes)
throws NoSuchAlgorithmException,
InvalidKeyException
pwdBytes - byte[]NoSuchAlgorithmExceptionInvalidKeyExceptionCopyright © 2005–2015 Alfresco Software. All rights reserved.