Examples of Rijndael


Examples of freenet.crypt.ciphers.Rijndael

    System.arraycopy(salt, 0, iv2, 0, 0x10);
    System.arraycopy(iv, 0, iv2, 0x10, 0x10);

    try {
      BlockCipher aes = new Rijndael(256, 256);
      aes.initialize(key);

      return PCFBMode.create(aes, iv2);
    } catch (UnsupportedCipherException e) {
      Logger.error(this, "Rijndael not supported!", e);
      throw new Error("Rijndael not supported!", e);
View Full Code Here

Examples of freenet.crypt.ciphers.Rijndael

    this.random = random;
    position = 0;
    blockPosition = -1;
    blockOutput = new byte[32];
    try {
      cipher = new Rijndael(256, 256);
    } catch (UnsupportedCipherException e) {
      throw new Error(e);
    }
    cipher.initialize(databaseKey);
  }
View Full Code Here

Examples of freenet.crypt.ciphers.Rijndael

      random.nextBytes(newsalt);
      byte[] diskSalt = newsalt;
      if(masterKey != null) {
        BlockCipher cipher;
        try {
          cipher = new Rijndael(256, 128);
        } catch (UnsupportedCipherException e) {
          throw new Error("Impossible: no Rijndael(256,128): "+e, e);
        }
        cipher.initialize(masterKey);
        diskSalt = new byte[0x10];
        cipher.encipher(newsalt, diskSalt);
        if(logDEBUG)
          Logger.debug(this, "Encrypting with "+HexUtil.bytesToHex(newsalt)+" from "+HexUtil.bytesToHex(diskSalt));
      }
      cipherManager = new CipherManager(newsalt, diskSalt);

      writeConfigFile();
      return true;
    } else {
      try {
        // try to load
        RandomAccessFile raf = new RandomAccessFile(configFile, "r");
        try {
          byte[] salt = new byte[0x10];
          raf.readFully(salt);

          byte[] diskSalt = salt;
          if(masterKey != null) {
            BlockCipher cipher;
            try {
              cipher = new Rijndael(256, 128);
            } catch (UnsupportedCipherException e) {
              throw new Error("Impossible: no Rijndael(256,128): "+e, e);
            }
            cipher.initialize(masterKey);
            salt = new byte[0x10];
View Full Code Here

Examples of freenet.crypt.ciphers.Rijndael

        "\nThis:      " + HexUtil.bytesToHex(identityHash) +
        "\nThis hash: " + HexUtil.bytesToHex(identityHashHash) +
        "\nFor:       " + getPeer());

    try {
      incomingSetupCipher = new Rijndael(256, 256);
      incomingSetupCipher.initialize(incomingSetupKey);
      outgoingSetupCipher = new Rijndael(256, 256);
      outgoingSetupCipher.initialize(outgoingSetupKey);
      anonymousInitiatorSetupCipher = new Rijndael(256, 256);
      anonymousInitiatorSetupCipher.initialize(identityHash);
    } catch(UnsupportedCipherException e1) {
      Logger.error(this, "Caught: " + e1);
      throw new Error(e1);
    }
View Full Code Here

Examples of freenet.crypt.ciphers.Rijndael

                outerKey = md.digest();
            }
        }
        BlockCipher cipher;
        try {
          cipher = new Rijndael(256, 256);
        } catch (UnsupportedCipherException e) {
          // Impossible
          throw new Error(e);
        }
//        System.err.println("Outer key: "+HexUtil.bytesToHex(outerKey));
View Full Code Here

Examples of freenet.crypt.ciphers.Rijndael

        md.update(pwd);
        md.update(salt);
        byte[] outerKey = md.digest();
        BlockCipher cipher;
        try {
            cipher = new Rijndael(256, 256);
        } catch (UnsupportedCipherException e) {
            // Impossible
            throw new Error(e);
        }
//      System.err.println("Outer key: "+HexUtil.bytesToHex(outerKey));
View Full Code Here

Examples of freenet.crypt.ciphers.Rijndael

    baos.write(hash, 0, HASH_LENGTH);
    data = baos.toByteArray();

    BlockCipher cipher;
    try {
      cipher = new Rijndael(256, 256);
    } catch (UnsupportedCipherException e) {
      // Impossible
      throw new Error(e);
    }
    cipher.initialize(outerKey);
View Full Code Here

Examples of freenet.crypt.ciphers.Rijndael

    packetMangler = new FNPPacketMangler(node, this, socket);

    detector = new NodeIPPortDetector(node, node.ipDetector, this, enableARKs);

    anonSetupCipher = new Rijndael(256,256);

    } catch (NodeInitException e) {
      config.stopping(this);
      throw e;
    } catch (RuntimeException e) {
View Full Code Here

Examples of gnu.javax.crypto.cipher.Rijndael

    }

  public void test(TestHarness harness)
  {
    harness.checkPoint("TestOfRijndael");
    cipher = new Rijndael();
    HashMap attrib = new HashMap();
    attrib.put(IBlockCipher.CIPHER_BLOCK_SIZE, new Integer(16));
    attrib.put(IBlockCipher.KEY_MATERIAL, new byte[16]);
    try
      {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.