You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Jerry Chen (JIRA)" <ji...@apache.org> on 2016/04/25 04:47:13 UTC

[jira] [Commented] (CRYPTO-13) The API differences between apache.commons.crypto and JCE

    [ https://issues.apache.org/jira/browse/CRYPTO-13?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15255807#comment-15255807 ] 

Jerry Chen commented on CRYPTO-13:
----------------------------------

Thanks Xianda.
+1 for this catch.

For Cipher interface, we can reuse the java Key and ParameterSpec class to pass the parameters.
This can be same for CryptoInputStream and CryptoOutputStream.

While for CTRCryptoInputStream and CTRCryptoOutputStream, as it is specific to CTR mode whose parameter is known. So we can consider to keep as it is. How you think?



> The API differences between apache.commons.crypto and JCE
> ---------------------------------------------------------
>
>                 Key: CRYPTO-13
>                 URL: https://issues.apache.org/jira/browse/CRYPTO-13
>             Project: Commons Crypto
>          Issue Type: Improvement
>            Reporter: Xianda Ke
>
> Now, the API of CryptoInputStream & CryptoOutputStream are slightly different from JCE.
> In JCE, the cipher must be fully initialized before being used by a CipherInputStream
> {code}
> // Jce API sample
> Cipher c= Cipher.getInstance("AES/GCM/NoPadding", "SunJCE");
> c.init(Cipher.DECRYPT_MODE, key, new GCMParameterSpec(128, iv));
> CipherInputStream cin = new CipherInputStream (InputStream is, Cipher c );
> {code}
> Now, we do the initialization of cipher in the ctor of CryptoInputStream.
> {code}
> //apache.commons.crypto API:
> CryptoInputStream(CipherTransformation transformation,  Properties props, InputStream in, byte[] key, byte[] iv)
> {code}
> We should add an interface with two parameters like JCE. This interface would be convenient to support other mode in future such as GCM.
> And, Keeping the same API as JCE would more friendly to users.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)