Package org.odftoolkit.odfdom.type

Examples of org.odftoolkit.odfdom.type.Base64Binary


      IvParameterSpec ivParameterSpec = new IvParameterSpec(iv);
      cipher.init(Cipher.ENCRYPT_MODE, key, ivParameterSpec);
      encryptedData = cipher.doFinal(compressedData, 0, compressedDataLength);
     
      // 9.update file entry encryption data.
      String checksum = new Base64Binary(checksumBytes).toString();
      FileEntryElement fileEntryElement = fileEntry.getOdfElement();
      EncryptionDataElement encryptionDataElement = OdfElement.findFirstChildNode(EncryptionDataElement.class, fileEntryElement);
      if (encryptionDataElement != null) {
        fileEntryElement.removeChild(encryptionDataElement);
      }
      encryptionDataElement = fileEntryElement.newEncryptionDataElement(checksum, "SHA1/1K");
      String initialisationVector = new Base64Binary(iv).toString();
      AlgorithmElement algorithmElement = OdfElement.findFirstChildNode(AlgorithmElement.class, encryptionDataElement);
      if (algorithmElement != null) {
        encryptionDataElement.removeChild(algorithmElement);
      }
      algorithmElement = encryptionDataElement.newAlgorithmElement("Blowfish CFB", initialisationVector);
      String saltStr = new Base64Binary(salt).toString();
      KeyDerivationElement keyDerivationElement = OdfElement.findFirstChildNode(KeyDerivationElement.class, encryptionDataElement);
      if (keyDerivationElement != null) {
        encryptionDataElement.removeChild(keyDerivationElement);
      }
      keyDerivationElement = encryptionDataElement.newKeyDerivationElement(1024, "PBKDF2", saltStr);
View Full Code Here


      // valid checksum
      md.reset();
      md.update(decryptedData, 0, (decryptedData.length > 1024 ? 1024 : decryptedData.length));
      byte[] checksumBytes = new byte[20];
      md.digest(checksumBytes, 0, 20);
      String newChecksum = new Base64Binary(checksumBytes).toString();
      if (newChecksum.equals(checksum)) {
        // decompress the bytes
        Inflater decompresser = new Inflater(true);
        decompresser.setInput(decryptedData);
        decompressData = new byte[manifestEntry.getSize()];
View Full Code Here

TOP

Related Classes of org.odftoolkit.odfdom.type.Base64Binary

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.