[
https://issues.apache.org/jira/browse/COMPRESS-633?focusedWorklogId=832511&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-832511
]
ASF GitHub Bot logged work on COMPRESS-633:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 10/Dec/22 12:36
Start Date: 10/Dec/22 12:36
Worklog Time Spent: 10m
Work Description: garydgregory commented on code in PR #332:
URL: https://github.com/apache/commons-compress/pull/332#discussion_r1037641840
##########
src/main/java/org/apache/commons/compress/archivers/sevenz/AES256SHA256Decoder.java:
##########
@@ -126,4 +115,121 @@ public void close() throws IOException {
}
};
}
+
+ @Override
+ OutputStream encode(OutputStream out, Object options) throws IOException {
+ AES256Options opts = (AES256Options) options;
+ final byte[] aesKeyBytes = sha256Password(opts.password,
opts.numCyclesPower, opts.salt);
+ final SecretKey aesKey = new SecretKeySpec(aesKeyBytes, "AES");
+
+ final Cipher cipher;
+ try {
+ cipher = Cipher.getInstance("AES/CBC/NoPadding");
+ cipher.init(Cipher.ENCRYPT_MODE, aesKey, new
IvParameterSpec(opts.iv));
+ } catch (final GeneralSecurityException generalSecurityException) {
+ throw new IOException(
+ "Encryption error " + "(do you have the JCE Unlimited Strength
Jurisdiction Policy Files installed?)",
Review Comment:
Why is a new Random instance allocated each time?
Issue Time Tracking
-------------------
Worklog Id: (was: 832511)
Time Spent: 2h 10m (was: 2h)
> Adding support for SevenZ password encryption
> ---------------------------------------------
>
> Key: COMPRESS-633
> URL: https://issues.apache.org/jira/browse/COMPRESS-633
> Project: Commons Compress
> Issue Type: Improvement
> Components: Compressors
> Affects Versions: 1.22
> Reporter: Daniel Santos
> Priority: Major
> Labels: contributing, features
> Time Spent: 2h 10m
> Remaining Estimate: 0h
>
> 👉🏼 The purpose is to provide password based encryption for 7z compression in
> the same way of decryption already supported, so go forward of [one know
> limitation|https://commons.apache.org/proper/commons-compress/limitations.html]
> ☝️In this way, I would like to submit my contribution based on the existing
> implementation of decryption and the [C++ implementation of 7z
> |https://github.com/kornelski/7z/blob/main/CPP/7zip/Crypto/7zAes.cpp]
> ✅ I added one unit test
>
> I prepared a [Pull Request on
> GitHub|https://github.com/apache/commons-compress/pull/332]
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)