static byte[] computeResponse(byte[] responseKey, byte[] serverChallenge, byte[] clientData, int offset, int length) { HMACT64 hmac = new HMACT64(responseKey); hmac.update(serverChallenge); hmac.update(clientData, offset, length); byte[] mac = hmac.digest(); byte[] ret = new byte[mac.length + clientData.length]; System.arraycopy(mac, 0, ret, 0, mac.length); System.arraycopy(clientData, 0, ret, mac.length, clientData.length); return ret; } public static byte[] getLMv2Response(
/** * * @param key * @return HMACT64 MAC */ public static MessageDigest getHMACT64 ( byte[] key ) { return new HMACT64(key); }
/** * 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++) { ipad[i] = (byte) (key[i] ^ IPAD); opad[i] = (byte) (key[i] ^ OPAD); } for (int i = length; i < BLOCK_LENGTH; i++) { ipad[i] = IPAD; opad[i] = OPAD; } try { md5 = MessageDigest.getInstance("MD5"); } catch (Exception ex) { throw new IllegalStateException(ex.getMessage()); } engineReset(); }
/** * * @param key * @return HMACT64 MAC */ public static MessageDigest getHMACT64 ( byte[] key ) { return new HMACT64(key); }
/** * 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++) { ipad[i] = (byte) (key[i] ^ IPAD); opad[i] = (byte) (key[i] ^ OPAD); } for (int i = length; i < BLOCK_LENGTH; i++) { ipad[i] = IPAD; opad[i] = OPAD; } try { md5 = MessageDigest.getInstance("MD5"); } catch (Exception ex) { throw new IllegalStateException(ex.getMessage()); } engineReset(); }
static byte[] computeResponse(byte[] responseKey, byte[] serverChallenge, byte[] clientData, int offset, int length) { HMACT64 hmac = new HMACT64(responseKey); hmac.update(serverChallenge); hmac.update(clientData, offset, length); byte[] mac = hmac.digest(); byte[] ret = new byte[mac.length + clientData.length]; System.arraycopy(mac, 0, ret, 0, mac.length); System.arraycopy(clientData, 0, ret, mac.length, clientData.length); return ret; } public static byte[] getLMv2Response(
@Override public Object clone () { try { return new HMACT64(this); } catch ( CloneNotSupportedException ex ) { throw new IllegalStateException(ex.getMessage()); } }
/** * 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++) { ipad[i] = (byte) (key[i] ^ IPAD); opad[i] = (byte) (key[i] ^ OPAD); } for (int i = length; i < BLOCK_LENGTH; i++) { ipad[i] = IPAD; opad[i] = OPAD; } try { md5 = MessageDigest.getInstance("MD5"); } catch (Exception ex) { throw new IllegalStateException(ex.getMessage()); } engineReset(); }
static byte[] computeResponse(byte[] responseKey, byte[] serverChallenge, byte[] clientData, int offset, int length) { HMACT64 hmac = new HMACT64(responseKey); hmac.update(serverChallenge); hmac.update(clientData, offset, length); byte[] mac = hmac.digest(); byte[] ret = new byte[mac.length + clientData.length]; System.arraycopy(mac, 0, ret, 0, mac.length); System.arraycopy(clientData, 0, ret, mac.length, clientData.length); return ret; } public static byte[] getLMv2Response(
@Override public Object clone () { try { return new HMACT64(this); } catch ( CloneNotSupportedException ex ) { throw new IllegalStateException(ex.getMessage()); } }
/** * 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++) { ipad[i] = (byte) (key[i] ^ IPAD); opad[i] = (byte) (key[i] ^ OPAD); } for (int i = length; i < BLOCK_LENGTH; i++) { ipad[i] = IPAD; opad[i] = OPAD; } try { md5 = MessageDigest.getInstance("MD5"); } catch (Exception ex) { throw new IllegalStateException(ex.getMessage()); } engineReset(); }
public static byte[] nTOWFv2(String domain, String username, String password) { try { MD4 md4 = new MD4(); md4.update(password.getBytes(SmbConstants.UNI_ENCODING)); HMACT64 hmac = new HMACT64(md4.digest()); hmac.update(username.toUpperCase().getBytes(SmbConstants.UNI_ENCODING)); hmac.update(domain.getBytes(SmbConstants.UNI_ENCODING)); return hmac.digest(); } catch (UnsupportedEncodingException uee) { throw new RuntimeException(uee.getMessage()); } } static byte[] computeResponse(byte[] responseKey,
public Object clone() { try { return new HMACT64(this); } catch (CloneNotSupportedException ex) { throw new IllegalStateException(ex.getMessage()); } }
/** * 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(); }
public static byte[] nTOWFv2(String domain, String username, String password) { try { MD4 md4 = new MD4(); md4.update(password.getBytes(SmbConstants.UNI_ENCODING)); HMACT64 hmac = new HMACT64(md4.digest()); hmac.update(username.toUpperCase().getBytes(SmbConstants.UNI_ENCODING)); hmac.update(domain.getBytes(SmbConstants.UNI_ENCODING)); return hmac.digest(); } catch (UnsupportedEncodingException uee) { throw new RuntimeException(uee.getMessage()); } } static byte[] computeResponse(byte[] responseKey,
public Object clone() { try { return new HMACT64(this); } catch (CloneNotSupportedException ex) { throw new IllegalStateException(ex.getMessage()); } }
/** * 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(); }
public static byte[] nTOWFv2(String domain, String username, String password) { try { MD4 md4 = new MD4(); md4.update(password.getBytes(SmbConstants.UNI_ENCODING)); HMACT64 hmac = new HMACT64(md4.digest()); hmac.update(username.toUpperCase().getBytes(SmbConstants.UNI_ENCODING)); hmac.update(domain.getBytes(SmbConstants.UNI_ENCODING)); return hmac.digest(); } catch (UnsupportedEncodingException uee) { throw new RuntimeException(uee.getMessage()); } } static byte[] computeResponse(byte[] responseKey,
public Object clone() { try { return new HMACT64(this); } catch (CloneNotSupportedException ex) { throw new IllegalStateException(ex.getMessage()); } }
HMACT64 hmac = new HMACT64(md4.digest()); hmac.update(user.toUpperCase().getBytes(SmbConstants.UNI_ENCODING)); hmac.update(domain.toUpperCase().getBytes(SmbConstants.UNI_ENCODING)); hmac = new HMACT64(hmac.digest()); hmac.update(challenge); hmac.update(clientChallenge); hmac.digest(response, 0, 16); System.arraycopy(clientChallenge, 0, response, 16, 8); return response;