733734735736737738739740741742743
// int inputOffset, int inputLen, byte[] output, int // outputOffset) // throws ShortBufferException - if the given output buffer is // too // small to hold the result ecipher.update(new byte[20], 0, 20, cipherText); fail("failed exception test - no ShortBufferException thrown"); } catch (ShortBufferException e) {
125126127128129130131132133134135
// int outLen = c1.update(in, 0, 2, out1, 0); outLen += c1.doFinal(in, 2, in.length - 2, out1, outLen); outLen = c2.update(out1, 0, 2, out2, 0); outLen += c2.doFinal(out1, 2, out1.length - 2, out2, outLen); if (!areEqual(in, out2)) {
373374375376377378379380381382383
7677787980818283848586
Cipher.ENCRYPT_MODE, sk, new IvParameterSpec(Hex.decode("F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF"))); for (int j = 0; j != plain.length; j++) { byte[] crypt = c.update(plain[j]); if (!areEqual(crypt, cipher[i][j])) { fail("AESSIC encrypt failed: key " + i + " block " + j); } }
8990919293949596979899
Cipher.DECRYPT_MODE, sk, new IvParameterSpec(Hex.decode("F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF"))); for (int j = 0; j != plain.length; j++) { byte[] crypt = c.update(cipher[i][j]); if (!areEqual(crypt, plain[j])) { fail("AESSIC decrypt failed: key " + i + " block " + j); } }
148149150151152153154155156157158
Cipher.ENCRYPT_MODE, sk, new IvParameterSpec(Hex.decode("F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF"))); for (int j = 0; j != plain.length; j++) { crypt = c.update(plain[j]); if (!areEqual(crypt, cipher[0][j])) { fail("AESSIC encrypt failed: key " + 0 + " block " + j); } }
204205206207208209210211212213214
11621163116411651166116711681169117011711172
if (serializedData != null) { int numBytes; byte[] buf = new byte[8192]; ByteArrayOutputStream baos = new ByteArrayOutputStream(); while ((numBytes = serializedData.read(buf)) != -1) { byte[] data = c.update(buf, 0, numBytes); baos.write(data); } baos.write(c.doFinal()); encryptedBytes = baos.toByteArray(); } else {
157158159160161162163164165166167
// c = Cipher.getInstance("RSA", "BC"); c.init(Cipher.ENCRYPT_MODE, pubKey, rand); c.update(input); out = c.doFinal(); if (!areEqual(out, output[0])) {