Examples of blockDecipher()


Examples of freenet.crypt.PCFBMode.blockDecipher()

    // Get the IV
    final PCFBMode pk = PCFBMode.create(c, decypheredPayload, decypheredPayloadOffset);
    decypheredPayloadOffset += ivLength;
    // Decrypt the payload
    pk.blockDecipher(decypheredPayload, decypheredPayloadOffset, decypheredPayload.length - decypheredPayloadOffset);
    /*
     * DecipheredData Format:
     * Signature-r,s
     * bootID, znoderef
     */
 
View Full Code Here

Examples of freenet.crypt.PCFBMode.blockDecipher()

      throw new Error(e);
    }
    aes.initialize(key.cryptoKey);
    // ECB-encrypted E(H(docname)) serves as IV.
    PCFBMode pcfb = PCFBMode.create(aes, key.ehDocname);
    pcfb.blockDecipher(decryptedHeaders, 0, decryptedHeaders.length);
    // First 32 bytes are the key
    byte[] dataDecryptKey = Arrays.copyOf(decryptedHeaders, DATA_DECRYPT_KEY_LENGTH);
    aes.initialize(dataDecryptKey);
    byte[] dataOutput = block.data.clone();
    // Data decrypt key should be unique, so use it as IV
View Full Code Here

Examples of freenet.crypt.PCFBMode.blockDecipher()

    byte[] dataDecryptKey = Arrays.copyOf(decryptedHeaders, DATA_DECRYPT_KEY_LENGTH);
    aes.initialize(dataDecryptKey);
    byte[] dataOutput = block.data.clone();
    // Data decrypt key should be unique, so use it as IV
    pcfb.reset(dataDecryptKey);
    pcfb.blockDecipher(dataOutput, 0, dataOutput.length);
    // 2 bytes - data length
    int dataLength = ((decryptedHeaders[DATA_DECRYPT_KEY_LENGTH] & 0xff) << 8) +
      (decryptedHeaders[DATA_DECRYPT_KEY_LENGTH+1] & 0xff);
    // Metadata flag is top bit
    if((dataLength & 32768) != 0) {
View Full Code Here

Examples of freenet.crypt.PCFBMode.blockDecipher()

        byte[] headers = block.headers;
        byte[] data = block.data;
    byte[] hbuf = Arrays.copyOfRange(headers, 2, headers.length);
        byte[] dbuf = Arrays.copyOf(data, data.length);
        // Decipher header first - functions as IV
        pcfb.blockDecipher(hbuf, 0, hbuf.length);
        pcfb.blockDecipher(dbuf, 0, dbuf.length);
        MessageDigest md256 = SHA256.getMessageDigest();
        byte[] dkey = key.cryptoKey;
        // Check: IV == hash of decryption key
        byte[] predIV = md256.digest(dkey);
View Full Code Here

Examples of freenet.crypt.PCFBMode.blockDecipher()

        byte[] data = block.data;
    byte[] hbuf = Arrays.copyOfRange(headers, 2, headers.length);
        byte[] dbuf = Arrays.copyOf(data, data.length);
        // Decipher header first - functions as IV
        pcfb.blockDecipher(hbuf, 0, hbuf.length);
        pcfb.blockDecipher(dbuf, 0, dbuf.length);
        MessageDigest md256 = SHA256.getMessageDigest();
        byte[] dkey = key.cryptoKey;
        // Check: IV == hash of decryption key
        byte[] predIV = md256.digest(dkey);
        SHA256.returnMessageDigest(md256); md256 = null;
View Full Code Here

Examples of freenet.crypt.PCFBMode.blockDecipher()

    }

    entry.plainRoutingKey = routingKey;

    PCFBMode cipher = makeCipher(entry.dataEncryptIV, entry.plainRoutingKey);
    cipher.blockDecipher(entry.header, 0, entry.header.length);
    cipher.blockDecipher(entry.data, 0, entry.data.length);

    entry.isEncrypted = false;

    return true;
View Full Code Here

Examples of freenet.crypt.PCFBMode.blockDecipher()

    entry.plainRoutingKey = routingKey;

    PCFBMode cipher = makeCipher(entry.dataEncryptIV, entry.plainRoutingKey);
    cipher.blockDecipher(entry.header, 0, entry.header.length);
    cipher.blockDecipher(entry.data, 0, entry.data.length);

    entry.isEncrypted = false;

    return true;
  }
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.