You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Sebb (JIRA)" <ji...@apache.org> on 2016/06/16 13:36:05 UTC

[jira] [Updated] (CRYPTO-77) Hide Stream's Ctor with cipher parameter

     [ https://issues.apache.org/jira/browse/CRYPTO-77?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb updated CRYPTO-77:
-----------------------
    Summary: Hide Stream's Ctor with cipher parameter  (was: Hide Steam's Ctor with cipher parameter)

> Hide Stream's Ctor with cipher parameter
> ----------------------------------------
>
>                 Key: CRYPTO-77
>                 URL: https://issues.apache.org/jira/browse/CRYPTO-77
>             Project: Commons Crypto
>          Issue Type: Bug
>            Reporter: Xianda Ke
>            Assignee: Xianda Ke
>
> Stream has such two Ctor:
> {code}
> // denoted as (a)
> public CryptoInputStream(InputStream in, CryptoCipher cipher,
>             int bufferSize, Key key, AlgorithmParameterSpec params)
> // denoted as (b)
> public CryptoInputStream(CipherTransformation transformation,
>             Properties props, InputStream in, Key key,
>             AlgorithmParameterSpec params)
> {code}
> if use Ctor (b), client user don't have to construct a cipher.  make sense. 
> But, in Ctor (a), the cipher argument is create outside Ctor, then it is initialized in CryptoInputStream's Ctor. The cipher’s construction is scattered. It is a bit confusing.
> Ctor (a) seem only used internally.  It would be better to hide Ctor (a) for user.
> In future, we can consider this:
> {code}
> // don't pass key and iv param, the cipher should be initialized outside
> // similar to JDK, and more scalable to support GCM, CCM modes.
> CryptoInputStream(InputStream in, CryptoCipher cipher,  int bufferSize)
> {code}
> right now, we just hide Ctor (a) for user.



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