Package gnu.javax.crypto.mode

Examples of gnu.javax.crypto.mode.IAuthenticatedMode


                    Util.toBytesFromString("CFC46AFC253B4652B1AF3795B124AB6E") } };

  public void test(TestHarness harness)
  {
    harness.checkPoint("EAX/AES-128");
    IAuthenticatedMode mode = (IAuthenticatedMode)
    //         ModeFactory.getInstance(Registry.EAX_MODE, Registry.AES_CIPHER, 16);
    new EAX(CipherFactory.getInstance(Registry.AES_CIPHER), 16);
    HashMap attr = new HashMap();
    attr.put(IAuthenticatedMode.MODE_BLOCK_SIZE, new Integer(1));
    for (int i = 0; i < TESTS.length; i++)
      {
        attr.put(IAuthenticatedMode.KEY_MATERIAL, TESTS[i][0]);
        attr.put(IAuthenticatedMode.IV, TESTS[i][1]);
        try
          {
            mode.reset();
            mode.init(attr);
            mode.update(TESTS[i][3], 0, TESTS[i][3].length);
            byte[] ct = new byte[TESTS[i][2].length];
            for (int j = 0; j < TESTS[i][2].length; j += mode.currentBlockSize())
              {
                mode.update(TESTS[i][2], j, ct, j);
              }
            byte[] tag = mode.digest();
            harness.verbose(" KEY: " + Util.toString(TESTS[i][0]));
            harness.verbose("  IV: " + Util.toString(TESTS[i][1]));
            harness.verbose(" MSG: " + Util.toString(TESTS[i][2]));
            harness.verbose(" HDR: " + Util.toString(TESTS[i][3]));
            harness.verbose(" ECT: " + Util.toString(TESTS[i][4]));
View Full Code Here

TOP

Related Classes of gnu.javax.crypto.mode.IAuthenticatedMode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.