Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
What Is poi-5.2.3.jar?
What Is poi-5.2.3.jar?
✍: FYIcenter.com
poi-5.2.3.jar is one of the JAR files for Apache POI 5.2.3, which
provides an API for Microsoft document files of Word, Excel, PowerPoint, and Visio.
poi-5.2.3.jar supports Apache POI components that read and write Microsoft's OLE 2 Compound document format, which is used in early versions of Microsoft Office tools like Word 97, Excel 97, PowerPoint 97, etc.
poi-5.2.3.jar is distributed as part of the poi-bin-5.2.3-20220909.zip download file.
JAR File Size and Download Location:
JAR name: poi-5.2.3.jar Target JDK version: 9 File name: poi.jar, poi-5.2.3.jar File size: 2964641 bytes Release date: 09-09-2022 Download: Apache POI Website
Here are Java Source Code files for poi-5.2.3.jar:
⏎ org/apache/poi/poifs/crypt/EncryptionInfo.java
/* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ package org.apache.poi.poifs.crypt; import static org.apache.poi.poifs.crypt.EncryptionMode.agile; import static org.apache.poi.poifs.crypt.EncryptionMode.binaryRC4; import static org.apache.poi.poifs.crypt.EncryptionMode.cryptoAPI; import static org.apache.poi.poifs.crypt.EncryptionMode.standard; import static org.apache.poi.poifs.crypt.EncryptionMode.xor; import static org.apache.poi.util.GenericRecordUtil.getBitsAsString; import java.io.IOException; import java.util.Collections; import java.util.LinkedHashMap; import java.util.Map; import java.util.function.Supplier; import org.apache.poi.EncryptedDocumentException; import org.apache.poi.common.usermodel.GenericRecord; import org.apache.poi.poifs.filesystem.DirectoryNode; import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.util.BitField; import org.apache.poi.util.BitFieldFactory; import org.apache.poi.util.LittleEndianInput; /** * Wrapper for the EncryptionInfo node of encrypted documents */ public class EncryptionInfo implements GenericRecord { /** * Document entry name for encryption info xml descriptor */ public static final String ENCRYPTION_INFO_ENTRY = "EncryptionInfo"; /** * A flag that specifies whether CryptoAPI RC4 or ECMA-376 encryption * ECMA-376 is used. It MUST be 1 unless flagExternal is 1. If flagExternal is 1, it MUST be 0. */ public static final BitField flagCryptoAPI = BitFieldFactory.getInstance(0x04); /** * A value that MUST be 0 if document properties are encrypted. * The encryption of document properties is specified in section 2.3.5.4. */ @SuppressWarnings("WeakerAccess") public static final BitField flagDocProps = BitFieldFactory.getInstance(0x08); /** * A value that MUST be 1 if extensible encryption is used. If this value is 1, * the value of every other field in this structure MUST be 0. */ @SuppressWarnings("WeakerAccess") public static final BitField flagExternal = BitFieldFactory.getInstance(0x10); /** * A value that MUST be 1 if the protected content is an ECMA-376 document * ECMA-376. If the fAES bit is 1, the fCryptoAPI bit MUST also be 1. */ public static final BitField flagAES = BitFieldFactory.getInstance(0x20); private static final int[] FLAGS_MASKS = { 0x04, 0x08, 0x10, 0x20 }; private static final String[] FLAGS_NAMES = { "CRYPTO_API", "DOC_PROPS", "EXTERNAL", "AES" }; private final EncryptionMode encryptionMode; private final int versionMajor; private final int versionMinor; private final int encryptionFlags; private EncryptionHeader header; private EncryptionVerifier verifier; private Decryptor decryptor; private Encryptor encryptor; /** * Opens for decryption */ public EncryptionInfo(POIFSFileSystem fs) throws IOException { this(fs.getRoot()); } /** * Opens for decryption */ public EncryptionInfo(DirectoryNode dir) throws IOException { this(dir.createDocumentInputStream(ENCRYPTION_INFO_ENTRY), null); } public EncryptionInfo(LittleEndianInput dis, EncryptionMode preferredEncryptionMode) throws IOException { if (preferredEncryptionMode == xor) { versionMajor = xor.versionMajor; versionMinor = xor.versionMinor; } else { versionMajor = dis.readUShort(); versionMinor = dis.readUShort(); } if (versionMajor == xor.versionMajor && versionMinor == xor.versionMinor) { encryptionMode = xor; encryptionFlags = -1; } else if (versionMajor == binaryRC4.versionMajor && versionMinor == binaryRC4.versionMinor) { encryptionMode = binaryRC4; encryptionFlags = -1; } else if (2 <= versionMajor && versionMajor <= 4 && versionMinor == 2) { encryptionFlags = dis.readInt(); encryptionMode = (preferredEncryptionMode == cryptoAPI || !flagAES.isSet(encryptionFlags)) ? cryptoAPI : standard; } else if (versionMajor == agile.versionMajor && versionMinor == agile.versionMinor){ encryptionMode = agile; encryptionFlags = dis.readInt(); } else { encryptionFlags = dis.readInt(); throw new EncryptedDocumentException( "Unknown encryption: version major: "+versionMajor+ " / version minor: "+versionMinor+ " / fCrypto: "+flagCryptoAPI.isSet(encryptionFlags)+ " / fExternal: "+flagExternal.isSet(encryptionFlags)+ " / fDocProps: "+flagDocProps.isSet(encryptionFlags)+ " / fAES: "+flagAES.isSet(encryptionFlags)); } EncryptionInfoBuilder eib; try { eib = getBuilder(encryptionMode); } catch (Exception e) { throw new IOException(e); } eib.initialize(this, dis); } /** * Prepares for encryption, using the given Encryption Mode, and * all other parameters as default. * @see #EncryptionInfo(EncryptionMode, CipherAlgorithm, HashAlgorithm, int, int, ChainingMode) */ public EncryptionInfo(EncryptionMode encryptionMode) { this(encryptionMode, null, null, -1, -1, null); } /** * Constructs an EncryptionInfo from scratch * * @param encryptionMode see {@link EncryptionMode} for values, {@link EncryptionMode#cryptoAPI} is for * internal use only, as it's record based * @param cipherAlgorithm the cipher algorithm * @param hashAlgorithm the hash algorithm * @param keyBits the bit count of the key * @param blockSize the size of a cipher block * @param chainingMode the chaining mode * * @throws EncryptedDocumentException if the given parameters mismatch, e.g. only certain combinations * of keyBits, blockSize are allowed for a given {@link CipherAlgorithm} */ public EncryptionInfo( EncryptionMode encryptionMode , CipherAlgorithm cipherAlgorithm , HashAlgorithm hashAlgorithm , int keyBits , int blockSize , ChainingMode chainingMode ) { this.encryptionMode = encryptionMode; versionMajor = encryptionMode.versionMajor; versionMinor = encryptionMode.versionMinor; encryptionFlags = encryptionMode.encryptionFlags; EncryptionInfoBuilder eib; try { eib = getBuilder(encryptionMode); } catch (Exception e) { throw new EncryptedDocumentException(e); } eib.initialize(this, cipherAlgorithm, hashAlgorithm, keyBits, blockSize, chainingMode); } public EncryptionInfo(EncryptionInfo other) { encryptionMode = other.encryptionMode; versionMajor = other.versionMajor; versionMinor = other.versionMinor; encryptionFlags = other.encryptionFlags; header = (other.header == null) ? null : other.header.copy(); verifier = (other.verifier == null) ? null : other.verifier.copy(); if (other.decryptor != null) { decryptor = other.decryptor.copy(); decryptor.setEncryptionInfo(this); } if (other.encryptor != null) { encryptor = other.encryptor.copy(); encryptor.setEncryptionInfo(this); } } /** * Create the builder instance * * @param encryptionMode the encryption mode * @return an encryption info builder */ private static EncryptionInfoBuilder getBuilder(EncryptionMode encryptionMode) { return encryptionMode.builder.get(); } public int getVersionMajor() { return versionMajor; } public int getVersionMinor() { return versionMinor; } public int getEncryptionFlags() { return encryptionFlags; } public EncryptionHeader getHeader() { return header; } public EncryptionVerifier getVerifier() { return verifier; } public Decryptor getDecryptor() { return decryptor; } public Encryptor getEncryptor() { return encryptor; } public void setHeader(EncryptionHeader header) { this.header = header; } public void setVerifier(EncryptionVerifier verifier) { this.verifier = verifier; } public void setDecryptor(Decryptor decryptor) { this.decryptor = decryptor; } public void setEncryptor(Encryptor encryptor) { this.encryptor = encryptor; } public EncryptionMode getEncryptionMode() { return encryptionMode; } /** * @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()); } public EncryptionInfo copy() { return new EncryptionInfo(this); } @Override public Map<String, Supplier<?>> getGenericProperties() { final Map<String,Supplier<?>> m = new LinkedHashMap<>(); m.put("encryptionMode", this::getEncryptionMode); m.put("versionMajor", this::getVersionMajor); m.put("versionMinor", this::getVersionMinor); m.put("encryptionFlags", getBitsAsString(this::getEncryptionFlags, FLAGS_MASKS, FLAGS_NAMES)); m.put("header", this::getHeader); m.put("verifier", this::getVerifier); m.put("decryptor", this::getDecryptor); m.put("encryptor", this::getEncryptor); return Collections.unmodifiableMap(m); } }
⏎ org/apache/poi/poifs/crypt/EncryptionInfo.java
Or download all of them as a single archive file:
File name: poi-5.2.3-src.zip File size: 2479830 bytes Release date: 2022-09-09 Download
⇒ What Is poi-ooxml-5.2.3.jar?
⇐ What Is poi-bin-5.2.3-20220909.zip?
2017-04-04, 99037👍, 0💬
Popular Posts:
Xalan-Java, Version 2.7.1, is an XSLT processor for transforming XML documents into HTML, text, or o...
ZooKeeper is a centralized service for maintaining configuration information, naming, providing dist...
Where Can I see Java Source Code files for Xerces Java 2.11.2? Here are Java Source Code files for X...
JavaMail Source Code Files are provided in the source package file, httpcomponents-client-5. 2-src.zi...
What Is poi-5.2.3.jar? poi-5.2.3.jar is one of the JAR files for Apache POI 5.2.3, which provides an...