/** * @return true, if Document Summary / Summary are encrypted and stored in the {@code EncryptedStream} stream, * otherwise the Summaries aren't encrypted and located in their usual streams */ public boolean isDocPropsEncrypted() { return !flagDocProps.isSet(getEncryptionFlags()); }
@Override public void write(LittleEndianByteArrayOutputStream bos) { bos.writeShort(info.getVersionMajor()); bos.writeShort(info.getVersionMinor()); bos.writeInt(info.getEncryptionFlags()); header.write(bos); verifier.write(bos); } };
@Override public void write(LittleEndianByteArrayOutputStream bos) { // EncryptionVersionInfo (4 bytes): A Version structure (section 2.1.4), where // Version.vMajor MUST be 0x0004 and Version.vMinor MUST be 0x0004 bos.writeShort(info.getVersionMajor()); bos.writeShort(info.getVersionMinor()); // Reserved (4 bytes): A value that MUST be 0x00000040 bos.writeInt(info.getEncryptionFlags()); EncryptionDocument ed = createEncryptionDocument(); marshallEncryptionDocument(ed, bos); } };
@SuppressWarnings("resource") @Override public void serialize(LittleEndianOutput out) { out.writeShort(encryptionType); byte data[] = new byte[1024]; LittleEndianByteArrayOutputStream bos = new LittleEndianByteArrayOutputStream(data, 0); // NOSONAR switch (encryptionInfo.getEncryptionMode()) { case xor: ((XOREncryptionHeader)encryptionInfo.getHeader()).write(bos); ((XOREncryptionVerifier)encryptionInfo.getVerifier()).write(bos); break; case binaryRC4: out.writeShort(encryptionInfo.getVersionMajor()); out.writeShort(encryptionInfo.getVersionMinor()); ((BinaryRC4EncryptionHeader)encryptionInfo.getHeader()).write(bos); ((BinaryRC4EncryptionVerifier)encryptionInfo.getVerifier()).write(bos); break; case cryptoAPI: out.writeShort(encryptionInfo.getVersionMajor()); out.writeShort(encryptionInfo.getVersionMinor()); out.writeInt(encryptionInfo.getEncryptionFlags()); ((CryptoAPIEncryptionHeader)encryptionInfo.getHeader()).write(bos); ((CryptoAPIEncryptionVerifier)encryptionInfo.getVerifier()).write(bos); break; default: throw new EncryptedDocumentException("not supported"); } out.write(data, 0, bos.getWriteIndex()); }
/** * @return true, if Document Summary / Summary are encrypted and stored in the {@code EncryptedStream} stream, * otherwise the Summaries aren't encrypted and located in their usual streams */ public boolean isDocPropsEncrypted() { return !flagDocProps.isSet(getEncryptionFlags()); }
@Override public void write(LittleEndianByteArrayOutputStream bos) { // EncryptionVersionInfo (4 bytes): A Version structure (section 2.1.4), where // Version.vMajor MUST be 0x0004 and Version.vMinor MUST be 0x0004 bos.writeShort(info.getVersionMajor()); bos.writeShort(info.getVersionMinor()); // Reserved (4 bytes): A value that MUST be 0x00000040 bos.writeInt(info.getEncryptionFlags()); EncryptionDocument ed = createEncryptionDocument(); marshallEncryptionDocument(ed, bos); } };
@Override public void write(LittleEndianByteArrayOutputStream bos) { bos.writeShort(info.getVersionMajor()); bos.writeShort(info.getVersionMinor()); bos.writeInt(info.getEncryptionFlags()); header.write(bos); verifier.write(bos); } };
/** * Write the contents of the record back, so it can be written * to disk */ public void writeOut(OutputStream out) throws IOException { // Data byte data[] = new byte[1024]; LittleEndianByteArrayOutputStream bos = new LittleEndianByteArrayOutputStream(data, 0); bos.writeShort(ei.getVersionMajor()); bos.writeShort(ei.getVersionMinor()); bos.writeInt(ei.getEncryptionFlags()); ((CryptoAPIEncryptionHeader)ei.getHeader()).write(bos); ((CryptoAPIEncryptionVerifier)ei.getVerifier()).write(bos); // Header LittleEndian.putInt(_header, 4, bos.getWriteIndex()); out.write(_header); out.write(data, 0, bos.getWriteIndex()); bos.close(); }
leos.writeShort(ei.getVersionMinor()); if (ei.getEncryptionMode() == EncryptionMode.cryptoAPI) { leos.writeInt(ei.getEncryptionFlags());
@SuppressWarnings("resource") @Override public void serialize(LittleEndianOutput out) { out.writeShort(encryptionType); byte data[] = new byte[1024]; LittleEndianByteArrayOutputStream bos = new LittleEndianByteArrayOutputStream(data, 0); // NOSONAR switch (encryptionInfo.getEncryptionMode()) { case xor: ((XOREncryptionHeader)encryptionInfo.getHeader()).write(bos); ((XOREncryptionVerifier)encryptionInfo.getVerifier()).write(bos); break; case binaryRC4: out.writeShort(encryptionInfo.getVersionMajor()); out.writeShort(encryptionInfo.getVersionMinor()); ((BinaryRC4EncryptionHeader)encryptionInfo.getHeader()).write(bos); ((BinaryRC4EncryptionVerifier)encryptionInfo.getVerifier()).write(bos); break; case cryptoAPI: out.writeShort(encryptionInfo.getVersionMajor()); out.writeShort(encryptionInfo.getVersionMinor()); out.writeInt(encryptionInfo.getEncryptionFlags()); ((CryptoAPIEncryptionHeader)encryptionInfo.getHeader()).write(bos); ((CryptoAPIEncryptionVerifier)encryptionInfo.getVerifier()).write(bos); break; default: throw new EncryptedDocumentException("not supported"); } out.write(data, 0, bos.getWriteIndex()); }