protected void engineUpdate( byte[] input, int offset, int len) { macEngine.update(input, offset, len); }
protected void engineUpdate( byte[] input, int offset, int len) { macEngine.update(input, offset, len); }
public void write( byte[] b, int off, int len) throws IOException { mac.update(b, off, len); }
public void write( byte[] b, int off, int len) throws IOException { mac.update(b, off, len); }
protected void engineUpdate( byte[] input, int offset, int len) { macEngine.update(input, offset, len); }
public int read() throws IOException { int b = in.read(); if (b >= 0) { mac.update((byte)b); } return b; }
public int read() throws IOException { int b = in.read(); if (b >= 0) { mac.update((byte)b); } return b; }
public void processAADByte(byte in) { if (cipherInitialized) { throw new IllegalStateException("AAD data cannot be added after encryption/decryption processing has begun."); } mac.update(in); }
public void processAADBytes(byte[] in, int inOff, int len) { if (cipherInitialized) { throw new IllegalStateException("AAD data cannot be added after encryption/decryption processing has begun."); } mac.update(in, inOff, len); }
public int read( byte[] b, int off, int len) throws IOException { int n = in.read(b, off, len); if (n >= 0) { mac.update(b, off, n); } return n; }
protected void updateRecordMACLength(Mac mac, int len) { byte[] longLen = Pack.longToLittleEndian(len & 0xFFFFFFFFL); mac.update(longLen, 0, longLen.length); }
private void initCipher() { if (cipherInitialized) { return; } cipherInitialized = true; mac.doFinal(associatedTextMac, 0); byte[] tag = new byte[blockSize]; tag[blockSize - 1] = cTAG; mac.update(tag, 0, blockSize); }
public TlsSRPLoginParameters getLoginParameters(byte[] identity) { mac.update(PREFIX_SALT, 0, PREFIX_SALT.length); mac.update(identity, 0, identity.length); byte[] salt = new byte[mac.getMacSize()]; mac.doFinal(salt, 0); mac.update(PREFIX_PASSWORD, 0, PREFIX_PASSWORD.length); mac.update(identity, 0, identity.length); byte[] password = new byte[mac.getMacSize()]; mac.doFinal(password, 0); BigInteger verifier = verifierGenerator.generateVerifier(salt, identity, password); return new TlsSRPLoginParameters(group, verifier, salt); } }
private static void updateMac(Mac mac, BigInteger bigInteger) { byte[] byteArray = BigIntegers.asUnsignedByteArray(bigInteger); mac.update(byteArray, 0, byteArray.length); Arrays.fill(byteArray, (byte)0); }
private static void updateMac(Mac mac, String string) { byte[] byteArray = Strings.toUTF8ByteArray(string); mac.update(byteArray, 0, byteArray.length); Arrays.fill(byteArray, (byte)0); }
@Override public byte[] getMAC(final byte[] data) { byte[] n = new byte[this.sscBytes.length + data.length]; System.arraycopy(this.sscBytes, 0, n, 0, this.sscBytes.length); System.arraycopy(data, 0, n, this.sscBytes.length, data.length); n = addPadding(n); final BlockCipher cipher = new AESEngine(); final Mac mac = new CMac(cipher, 64); mac.init(this.keyP); mac.update(n, 0, n.length); final byte[] out = new byte[mac.getMacSize()]; mac.doFinal(out, 0); return out; }
@Override public byte[] doAesCmac(final byte[] data, final byte[] key) { final BlockCipher cipher = new AESEngine(); final org.spongycastle.crypto.Mac mac = new CMac(cipher, 64); final KeyParameter keyP = new KeyParameter(key); mac.init(keyP); mac.update(data, 0, data.length); final byte[] out = new byte[8]; mac.doFinal(out, 0); return out; }