本文整理了Java中org.apache.poi.poifs.crypt.EncryptionInfo.setHeader()
方法的一些代码示例,展示了EncryptionInfo.setHeader()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。EncryptionInfo.setHeader()
方法的具体详情如下:
包路径:org.apache.poi.poifs.crypt.EncryptionInfo
类名称:EncryptionInfo
方法名:setHeader
暂无
代码示例来源:origin: org.apache.poi/poi
@Override
public void initialize(EncryptionInfo info,
CipherAlgorithm cipherAlgorithm, HashAlgorithm hashAlgorithm,
int keyBits, int blockSize, ChainingMode chainingMode) {
info.setHeader(new BinaryRC4EncryptionHeader());
info.setVerifier(new BinaryRC4EncryptionVerifier());
Decryptor dec = new BinaryRC4Decryptor();
dec.setEncryptionInfo(info);
info.setDecryptor(dec);
Encryptor enc = new BinaryRC4Encryptor();
enc.setEncryptionInfo(info);
info.setEncryptor(enc);
}
}
代码示例来源:origin: org.apache.poi/poi
@Override
public void initialize(EncryptionInfo info, LittleEndianInput dis)
throws IOException {
info.setHeader(new XOREncryptionHeader());
info.setVerifier(new XOREncryptionVerifier(dis));
Decryptor dec = new XORDecryptor();
dec.setEncryptionInfo(info);
info.setDecryptor(dec);
Encryptor enc = new XOREncryptor();
enc.setEncryptionInfo(info);
info.setEncryptor(enc);
}
代码示例来源:origin: org.apache.poi/poi
@Override
public void initialize(EncryptionInfo info,
CipherAlgorithm cipherAlgorithm, HashAlgorithm hashAlgorithm,
int keyBits, int blockSize, ChainingMode chainingMode) {
info.setHeader(new XOREncryptionHeader());
info.setVerifier(new XOREncryptionVerifier());
Decryptor dec = new XORDecryptor();
dec.setEncryptionInfo(info);
info.setDecryptor(dec);
Encryptor enc = new XOREncryptor();
enc.setEncryptionInfo(info);
info.setEncryptor(enc);
}
}
代码示例来源:origin: org.apache.poi/poi
/**
* initialize the builder from a stream
*/
@Override
public void initialize(EncryptionInfo info, LittleEndianInput dis) throws IOException {
/* int hSize = */ dis.readInt();
StandardEncryptionHeader header = new StandardEncryptionHeader(dis);
info.setHeader(header);
info.setVerifier(new StandardEncryptionVerifier(dis, header));
if (info.getVersionMinor() == 2 && (info.getVersionMajor() == 3 || info.getVersionMajor() == 4)) {
StandardDecryptor dec = new StandardDecryptor();
dec.setEncryptionInfo(info);
info.setDecryptor(dec);
}
}
代码示例来源:origin: org.apache.poi/poi
@Override
public void initialize(EncryptionInfo info, LittleEndianInput dis)
throws IOException {
int vMajor = info.getVersionMajor();
int vMinor = info.getVersionMinor();
assert (vMajor == 1 && vMinor == 1);
info.setHeader(new BinaryRC4EncryptionHeader());
info.setVerifier(new BinaryRC4EncryptionVerifier(dis));
Decryptor dec = new BinaryRC4Decryptor();
dec.setEncryptionInfo(info);
info.setDecryptor(dec);
Encryptor enc = new BinaryRC4Encryptor();
enc.setEncryptionInfo(info);
info.setEncryptor(enc);
}
代码示例来源:origin: org.apache.poi/poi
/**
* initialize the builder from a stream
*/
@Override
public void initialize(EncryptionInfo info, LittleEndianInput dis)
throws IOException {
/* int hSize = */ dis.readInt();
CryptoAPIEncryptionHeader header = new CryptoAPIEncryptionHeader(dis);
info.setHeader(header);
info.setVerifier(new CryptoAPIEncryptionVerifier(dis, header));
CryptoAPIDecryptor dec = new CryptoAPIDecryptor();
dec.setEncryptionInfo(info);
info.setDecryptor(dec);
CryptoAPIEncryptor enc = new CryptoAPIEncryptor();
enc.setEncryptionInfo(info);
info.setEncryptor(enc);
}
代码示例来源:origin: org.apache.poi/poi
/**
* initialize the builder from scratch
*/
@Override
public void initialize(EncryptionInfo info,
CipherAlgorithm cipherAlgorithm, HashAlgorithm hashAlgorithm,
int keyBits, int blockSize, ChainingMode chainingMode) {
if (cipherAlgorithm == null) {
cipherAlgorithm = CipherAlgorithm.rc4;
}
if (hashAlgorithm == null) {
hashAlgorithm = HashAlgorithm.sha1;
}
if (keyBits == -1) {
keyBits = 0x28;
}
assert(cipherAlgorithm == CipherAlgorithm.rc4 && hashAlgorithm == HashAlgorithm.sha1);
info.setHeader(new CryptoAPIEncryptionHeader(cipherAlgorithm, hashAlgorithm, keyBits, blockSize, chainingMode));
info.setVerifier(new CryptoAPIEncryptionVerifier(cipherAlgorithm, hashAlgorithm, keyBits, blockSize, chainingMode));
CryptoAPIDecryptor dec = new CryptoAPIDecryptor();
dec.setEncryptionInfo(info);
info.setDecryptor(dec);
CryptoAPIEncryptor enc = new CryptoAPIEncryptor();
enc.setEncryptionInfo(info);
info.setEncryptor(enc);
}
}
代码示例来源:origin: org.apache.poi/poi-ooxml
@Override
public void initialize(EncryptionInfo info, LittleEndianInput dis) throws IOException {
EncryptionDocument ed = parseDescriptor((InputStream)dis);
info.setHeader(new AgileEncryptionHeader(ed));
info.setVerifier(new AgileEncryptionVerifier(ed));
if (info.getVersionMajor() == EncryptionMode.agile.versionMajor
&& info.getVersionMinor() == EncryptionMode.agile.versionMinor) {
AgileDecryptor dec = new AgileDecryptor();
dec.setEncryptionInfo(info);
info.setDecryptor(dec);
AgileEncryptor enc = new AgileEncryptor();
enc.setEncryptionInfo(info);
info.setEncryptor(enc);
}
}
代码示例来源:origin: org.apache.poi/poi-ooxml
throw new EncryptedDocumentException("KeySize "+keyBits+" not allowed for Cipher "+ cipherAlgorithm);
info.setHeader(new AgileEncryptionHeader(cipherAlgorithm, hashAlgorithm, keyBits, blockSize, chainingMode));
info.setVerifier(new AgileEncryptionVerifier(cipherAlgorithm, hashAlgorithm, keyBits, blockSize, chainingMode));
AgileDecryptor dec = new AgileDecryptor();
代码示例来源:origin: org.apache.poi/poi
throw new EncryptedDocumentException("KeySize "+keyBits+" not allowed for Cipher "+ cipherAlgorithm);
info.setHeader(new StandardEncryptionHeader(cipherAlgorithm, hashAlgorithm, keyBits, blockSize, chainingMode));
info.setVerifier(new StandardEncryptionVerifier(cipherAlgorithm, hashAlgorithm, keyBits, blockSize, chainingMode));
StandardDecryptor dec = new StandardDecryptor();
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
@Override
public void initialize(EncryptionInfo info, LittleEndianInput dis)
throws IOException {
info.setHeader(new XOREncryptionHeader());
info.setVerifier(new XOREncryptionVerifier(dis));
Decryptor dec = new XORDecryptor();
dec.setEncryptionInfo(info);
info.setDecryptor(dec);
Encryptor enc = new XOREncryptor();
enc.setEncryptionInfo(info);
info.setEncryptor(enc);
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
@Override
public void initialize(EncryptionInfo info,
CipherAlgorithm cipherAlgorithm, HashAlgorithm hashAlgorithm,
int keyBits, int blockSize, ChainingMode chainingMode) {
info.setHeader(new XOREncryptionHeader());
info.setVerifier(new XOREncryptionVerifier());
Decryptor dec = new XORDecryptor();
dec.setEncryptionInfo(info);
info.setDecryptor(dec);
Encryptor enc = new XOREncryptor();
enc.setEncryptionInfo(info);
info.setEncryptor(enc);
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
@Override
public void initialize(EncryptionInfo info,
CipherAlgorithm cipherAlgorithm, HashAlgorithm hashAlgorithm,
int keyBits, int blockSize, ChainingMode chainingMode) {
info.setHeader(new BinaryRC4EncryptionHeader());
info.setVerifier(new BinaryRC4EncryptionVerifier());
Decryptor dec = new BinaryRC4Decryptor();
dec.setEncryptionInfo(info);
info.setDecryptor(dec);
Encryptor enc = new BinaryRC4Encryptor();
enc.setEncryptionInfo(info);
info.setEncryptor(enc);
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
/**
* initialize the builder from a stream
*/
@Override
public void initialize(EncryptionInfo info, LittleEndianInput dis) throws IOException {
/* int hSize = */ dis.readInt();
StandardEncryptionHeader header = new StandardEncryptionHeader(dis);
info.setHeader(header);
info.setVerifier(new StandardEncryptionVerifier(dis, header));
if (info.getVersionMinor() == 2 && (info.getVersionMajor() == 3 || info.getVersionMajor() == 4)) {
StandardDecryptor dec = new StandardDecryptor();
dec.setEncryptionInfo(info);
info.setDecryptor(dec);
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
/**
* initialize the builder from a stream
*/
@Override
public void initialize(EncryptionInfo info, LittleEndianInput dis)
throws IOException {
/* int hSize = */ dis.readInt();
CryptoAPIEncryptionHeader header = new CryptoAPIEncryptionHeader(dis);
info.setHeader(header);
info.setVerifier(new CryptoAPIEncryptionVerifier(dis, header));
CryptoAPIDecryptor dec = new CryptoAPIDecryptor();
dec.setEncryptionInfo(info);
info.setDecryptor(dec);
CryptoAPIEncryptor enc = new CryptoAPIEncryptor();
enc.setEncryptionInfo(info);
info.setEncryptor(enc);
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
@Override
public void initialize(EncryptionInfo info, LittleEndianInput dis)
throws IOException {
int vMajor = info.getVersionMajor();
int vMinor = info.getVersionMinor();
assert (vMajor == 1 && vMinor == 1);
info.setHeader(new BinaryRC4EncryptionHeader());
info.setVerifier(new BinaryRC4EncryptionVerifier(dis));
Decryptor dec = new BinaryRC4Decryptor();
dec.setEncryptionInfo(info);
info.setDecryptor(dec);
Encryptor enc = new BinaryRC4Encryptor();
enc.setEncryptionInfo(info);
info.setEncryptor(enc);
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
@Override
public void initialize(EncryptionInfo info, LittleEndianInput dis) throws IOException {
EncryptionDocument ed = parseDescriptor((InputStream)dis);
info.setHeader(new AgileEncryptionHeader(ed));
info.setVerifier(new AgileEncryptionVerifier(ed));
if (info.getVersionMajor() == EncryptionMode.agile.versionMajor
&& info.getVersionMinor() == EncryptionMode.agile.versionMinor) {
AgileDecryptor dec = new AgileDecryptor();
dec.setEncryptionInfo(info);
info.setDecryptor(dec);
AgileEncryptor enc = new AgileEncryptor();
enc.setEncryptionInfo(info);
info.setEncryptor(enc);
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
/**
* initialize the builder from scratch
*/
@Override
public void initialize(EncryptionInfo info,
CipherAlgorithm cipherAlgorithm, HashAlgorithm hashAlgorithm,
int keyBits, int blockSize, ChainingMode chainingMode) {
if (cipherAlgorithm == null) {
cipherAlgorithm = CipherAlgorithm.rc4;
}
if (hashAlgorithm == null) {
hashAlgorithm = HashAlgorithm.sha1;
}
if (keyBits == -1) {
keyBits = 0x28;
}
assert(cipherAlgorithm == CipherAlgorithm.rc4 && hashAlgorithm == HashAlgorithm.sha1);
info.setHeader(new CryptoAPIEncryptionHeader(cipherAlgorithm, hashAlgorithm, keyBits, blockSize, chainingMode));
info.setVerifier(new CryptoAPIEncryptionVerifier(cipherAlgorithm, hashAlgorithm, keyBits, blockSize, chainingMode));
CryptoAPIDecryptor dec = new CryptoAPIDecryptor();
dec.setEncryptionInfo(info);
info.setDecryptor(dec);
CryptoAPIEncryptor enc = new CryptoAPIEncryptor();
enc.setEncryptionInfo(info);
info.setEncryptor(enc);
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
throw new EncryptedDocumentException("KeySize "+keyBits+" not allowed for Cipher "+ cipherAlgorithm);
info.setHeader(new AgileEncryptionHeader(cipherAlgorithm, hashAlgorithm, keyBits, blockSize, chainingMode));
info.setVerifier(new AgileEncryptionVerifier(cipherAlgorithm, hashAlgorithm, keyBits, blockSize, chainingMode));
AgileDecryptor dec = new AgileDecryptor();
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
throw new EncryptedDocumentException("KeySize "+keyBits+" not allowed for Cipher "+ cipherAlgorithm);
info.setHeader(new StandardEncryptionHeader(cipherAlgorithm, hashAlgorithm, keyBits, blockSize, chainingMode));
info.setVerifier(new StandardEncryptionVerifier(cipherAlgorithm, hashAlgorithm, keyBits, blockSize, chainingMode));
StandardDecryptor dec = new StandardDecryptor();