[
https://issues.apache.org/jira/browse/HADOOP-10853?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14067181#comment-14067181
]
Colin Patrick McCabe commented on HADOOP-10853:
-----------------------------------------------
Thanks, this looks a lot better.
{code}
public static CryptoCodec getInstance(Configuration conf,
String transformation) {
{code}
Shouldn't this just take a cipher suite object? Taking a string just seems
confusing since then the caller has to figure out what is expected.
It would also be nice to standardize on calling these things "transformations"
or "cipher suites" but not both. I had to look it up to make sure they were
the same thing (they are, right?) :)
{code}
private static String getCodecConfigName(String transformation) {
{code}
Seems like this should be {{CipherSuite#getConfigSuffix}} or something. Again,
nice to move away from manipulating strings, and more towards methods on
objects and enums.
{code}
try {
random = (provider != null) ?
SecureRandom.getInstance(secureRandomAlg, provider) :
SecureRandom.getInstance(secureRandomAlg);
} catch (GeneralSecurityException e) {
LOG.warn(e.getMessage());
random = new SecureRandom();
}
{code}
It would be nice to handle this fallback logic inside
{{SecureRandom#getInstance}}. If we want a SecureRandom in any other place, we
don't want to duplicate this code.
> Refactor get instance of CryptoCodec and support create via
> algorithm/mode/padding.
> -----------------------------------------------------------------------------------
>
> Key: HADOOP-10853
> URL: https://issues.apache.org/jira/browse/HADOOP-10853
> Project: Hadoop Common
> Issue Type: Sub-task
> Components: security
> Reporter: Yi Liu
> Assignee: Yi Liu
> Fix For: 3.0.0
>
> Attachments: HADOOP-10853.001.patch, HADOOP-10853.002.patch
>
>
> We should be able to create instance of *CryptoCodec*:
> * via codec class name. (Applications may have config for different crypto
> codecs)
> * via algorithm/mode/padding. (For automatically decryption, we need to find
> correct crypto codec and proper implementation)
> * a default crypto codec through specific config.
> This JIRA is for
> * Create instance through cipher suite(algorithm/mode/padding)
> * Refactor create instance of {{CryptoCodec}} into {{CryptoCodecFactory}}
> We need to get all crypto codecs in system, this can be done via a Java
> ServiceLoader + hadoop.security.crypto.codecs config.
--
This message was sent by Atlassian JIRA
(v6.2#6252)