/** * Construct a digest with a non-zero starting sequence number * * @param macSigningKey * @param initialSequence */ public SMB1SigningDigest ( byte[] macSigningKey, int initialSequence ) { this.digest = Crypto.getMD5(); this.macSigningKey = macSigningKey; this.signSequence = initialSequence; }
/** * Construct a digest with a non-zero starting sequence number * * @param macSigningKey * @param initialSequence */ public SMB1SigningDigest ( byte[] macSigningKey, int initialSequence ) { this.digest = Crypto.getMD5(); this.macSigningKey = macSigningKey; this.signSequence = initialSequence; }
/** * This constructor used to instance a SigningDigest object for * signing/verifying SMB using kerberos session key. * The MAC Key = concat(Session Key, Digest of Challenge); * Because of Kerberos Authentication don't have challenge, * The MAC Key = Session Key * * @param macSigningKey * The MAC key used to sign or verify SMB. */ public SMB1SigningDigest ( byte[] macSigningKey ) { this.digest = Crypto.getMD5(); this.macSigningKey = macSigningKey; }
/** * This constructor used to instance a SigningDigest object for * signing/verifying SMB using kerberos session key. * The MAC Key = concat(Session Key, Digest of Challenge); * Because of Kerberos Authentication don't have challenge, * The MAC Key = Session Key * * @param macSigningKey * The MAC key used to sign or verify SMB. */ public SMB1SigningDigest ( byte[] macSigningKey ) { this.digest = Crypto.getMD5(); this.macSigningKey = macSigningKey; }
private static byte[] deriveKey ( byte[] masterKey, String cnst ) { MessageDigest md5 = Crypto.getMD5(); md5.update(masterKey); md5.update(cnst.getBytes(StandardCharsets.US_ASCII)); md5.update((byte) 0); return md5.digest(); }
private static byte[] deriveKey ( byte[] masterKey, String cnst ) { MessageDigest md5 = Crypto.getMD5(); md5.update(masterKey); md5.update(cnst.getBytes(StandardCharsets.US_ASCII)); md5.update((byte) 0); return md5.digest(); }
/** * * @param macSigningKey * @param bypass * @param initialSequence */ public SMB1SigningDigest ( byte[] macSigningKey, boolean bypass, int initialSequence ) { this.digest = Crypto.getMD5(); this.macSigningKey = macSigningKey; this.signSequence = initialSequence; this.bypass = bypass; if ( log.isTraceEnabled() ) { log.trace("macSigningKey:"); log.trace(Hexdump.toHexString(macSigningKey, 0, macSigningKey.length)); } }
/** * * @param macSigningKey * @param bypass * @param initialSequence */ public SMB1SigningDigest ( byte[] macSigningKey, boolean bypass, int initialSequence ) { this.digest = Crypto.getMD5(); this.macSigningKey = macSigningKey; this.signSequence = initialSequence; this.bypass = bypass; if ( log.isTraceEnabled() ) { log.trace("macSigningKey:"); log.trace(Hexdump.toHexString(macSigningKey, 0, macSigningKey.length)); } }
/** * * @param nTOWFv1 * @param serverChallenge * @param clientChallenge * @return the calculated response * @throws GeneralSecurityException */ public static byte[] getNTLM2Response ( byte[] nTOWFv1, byte[] serverChallenge, byte[] clientChallenge ) throws GeneralSecurityException { byte[] sessionHash = new byte[8]; MessageDigest md5 = Crypto.getMD5();; md5.update(serverChallenge); md5.update(clientChallenge, 0, 8); System.arraycopy(md5.digest(), 0, sessionHash, 0, 8); byte[] key = new byte[21]; System.arraycopy(nTOWFv1, 0, key, 0, 16); byte[] ntResponse = new byte[24]; NtlmUtil.E(key, sessionHash, ntResponse); return ntResponse; }
/** * * @param nTOWFv1 * @param serverChallenge * @param clientChallenge * @return the calculated response * @throws GeneralSecurityException */ public static byte[] getNTLM2Response ( byte[] nTOWFv1, byte[] serverChallenge, byte[] clientChallenge ) throws GeneralSecurityException { byte[] sessionHash = new byte[8]; MessageDigest md5 = Crypto.getMD5();; md5.update(serverChallenge); md5.update(clientChallenge, 0, 8); System.arraycopy(md5.digest(), 0, sessionHash, 0, 8); byte[] key = new byte[21]; System.arraycopy(nTOWFv1, 0, key, 0, 16); byte[] ntResponse = new byte[24]; NtlmUtil.E(key, sessionHash, ntResponse); return ntResponse; }
/** * Creates an HMACT64 instance which uses the given secret key material. * * @param key * The key material to use in hashing. */ public HMACT64 ( byte[] key ) { super("HMACT64"); int length = Math.min(key.length, BLOCK_LENGTH); for ( int i = 0; i < length; i++ ) { this.ipad[ i ] = (byte) ( key[ i ] ^ IPAD ); this.opad[ i ] = (byte) ( key[ i ] ^ OPAD ); } for ( int i = length; i < BLOCK_LENGTH; i++ ) { this.ipad[ i ] = IPAD; this.opad[ i ] = OPAD; } this.md5 = Crypto.getMD5(); engineReset(); }
/** * Creates an HMACT64 instance which uses the given secret key material. * * @param key * The key material to use in hashing. */ public HMACT64 ( byte[] key ) { super("HMACT64"); int length = Math.min(key.length, BLOCK_LENGTH); for ( int i = 0; i < length; i++ ) { this.ipad[ i ] = (byte) ( key[ i ] ^ IPAD ); this.opad[ i ] = (byte) ( key[ i ] ^ OPAD ); } for ( int i = length; i < BLOCK_LENGTH; i++ ) { this.ipad[ i ] = IPAD; this.opad[ i ] = OPAD; } this.md5 = Crypto.getMD5(); engineReset(); }
this.digest = Crypto.getMD5(); try { byte[] serverEncryptionKey = transport.getServerEncryptionKey();
this.digest = Crypto.getMD5(); try { byte[] serverEncryptionKey = transport.getServerEncryptionKey();