Package freenet.crypt

Examples of freenet.crypt.BlockCipher.initialize()


            throw new Error(e);
        }
        byte[] cryptoKey = key.cryptoKey;
        if(cryptoKey.length < Node.SYMMETRIC_KEY_LENGTH)
            throw new CHKDecodeException("Crypto key too short");
        cipher.initialize(key.cryptoKey);
        PCFBMode pcfb = PCFBMode.create(cipher);
        byte[] headers = block.headers;
        byte[] data = block.data;
    byte[] hbuf = Arrays.copyOfRange(headers, 2, headers.length);
        byte[] dbuf = Arrays.copyOf(data, data.length);
View Full Code Here


            cipher = new Rijndael(256, 256);
        } catch (UnsupportedCipherException e) {
          Logger.error(ClientCHKBlock.class, "Impossible: "+e, e);
            throw new Error(e);
        }
        cipher.initialize(encKey);
       
        // FIXME CRYPTO plainIV, the hash of the crypto key, is encrypted with a null IV.
        // In other words, it is XORed with E(0).
        // For splitfiles we reuse the same decryption key for multiple blocks; it is derived from the overall hash,
        // or it is set randomly.
View Full Code Here

    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

        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));
      }
View Full Code Here

            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];
            cipher.decipher(diskSalt, salt);
            if(logDEBUG)
              Logger.debug(this, "Encrypting (new) with "+HexUtil.bytesToHex(salt)+" from "+HexUtil.bytesToHex(diskSalt));
          }
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.