Package gnu.javax.crypto.cipher

Examples of gnu.javax.crypto.cipher.DES


      { "1C587F1C13924FEF", "305532286D6F295A", "63FAC0D034D9F793" } };

  public void test(TestHarness harness)
  {
    harness.checkPoint("TestOfDES");
    cipher = new DES();
    HashMap attrib = new HashMap();
    attrib.put(IBlockCipher.CIPHER_BLOCK_SIZE, new Integer(8));
    attrib.put(IBlockCipher.KEY_MATERIAL, new byte[8]);
    boolean oldCheckForWeakKeys = Properties.checkForWeakKeys();
    try
View Full Code Here


  private void test4WeakKeys(TestHarness harness)
  {
    harness.checkPoint("TestOfDES.test4WeakKeys");

    DES des = (DES) cipher;
    String msg;
    int i;
    for (i = 0; i < DES.WEAK_KEYS.length; i++)
      {
        msg = "detecting weak key 0x" + Util.dumpString(DES.WEAK_KEYS[i]);
        try
          {
            des.makeKey(DES.WEAK_KEYS[i], DES.KEY_SIZE);
            harness.fail(msg);
          }
        catch (WeakKeyException x)
          {
            harness.check(true, msg);
          }
        catch (Exception x)
          {
            harness.debug(x);
            harness.fail(msg + ": " + String.valueOf(x));
          }
      }

    for (i = 0; i < DES.SEMIWEAK_KEYS.length; i++)
      {
        msg = "detecting semi-weak key 0x"
              + Util.dumpString(DES.SEMIWEAK_KEYS[i]);
        try
          {
            des.makeKey(DES.SEMIWEAK_KEYS[i], DES.KEY_SIZE);
            harness.fail(msg);
          }
        catch (WeakKeyException x)
          {
            harness.check(true, msg);
          }
        catch (Exception x)
          {
            harness.debug(x);
            harness.fail(msg + ": " + String.valueOf(x));
          }
      }

    for (i = 0; i < DES.POSSIBLE_WEAK_KEYS.length; i++)
      {
        msg = "detecting possible weak key 0x"
              + Util.dumpString(DES.POSSIBLE_WEAK_KEYS[i]);
        try
          {
            des.makeKey(DES.POSSIBLE_WEAK_KEYS[i], DES.KEY_SIZE);
            harness.fail(msg);
          }
        catch (WeakKeyException x)
          {
            harness.check(true, msg);
View Full Code Here

    HashMap map2 = new HashMap();
    HashMap map3 = new HashMap();
    Cascade new3DES = new Cascade();
    Object des1 = new3DES.append(Stage.getInstance(
        ModeFactory.getInstance(
            Registry.ECB_MODE, new DES(), 8),
            Direction.FORWARD));
    Object des2 = new3DES.append(Stage.getInstance(
        ModeFactory.getInstance(
            Registry.ECB_MODE, new DES(), 8),
            Direction.REVERSED));
    Object des3 = new3DES.append(Stage.getInstance(
        ModeFactory.getInstance(
            Registry.ECB_MODE, new DES(), 8),
            Direction.FORWARD));

    map.put(des1, map1);
    map.put(des2, map2);
    map.put(des3, map3);
View Full Code Here

TOP

Related Classes of gnu.javax.crypto.cipher.DES

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.