brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aledsage <...@git.apache.org>
Subject [GitHub] incubator-brooklyn pull request: Jclouds tidy
Date Mon, 26 Jan 2015 11:10:07 GMT
Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/465#discussion_r23523396
  
    --- Diff: core/src/main/java/brooklyn/util/crypto/SecureKeys.java ---
    @@ -19,182 +19,149 @@
     package brooklyn.util.crypto;
     
     import java.io.ByteArrayInputStream;
    -import java.io.ByteArrayOutputStream;
    -import java.io.FileWriter;
     import java.io.IOException;
     import java.io.InputStream;
     import java.io.InputStreamReader;
     import java.io.StringWriter;
     import java.security.KeyPair;
    -import java.security.KeyPairGenerator;
    -import java.security.KeyStore;
    -import java.security.KeyStoreException;
    -import java.security.NoSuchAlgorithmException;
    +import java.security.PrivateKey;
    +import java.security.PublicKey;
     import java.security.Security;
    -import java.security.cert.CertificateException;
    -import java.security.cert.X509Certificate;
    -import java.util.NoSuchElementException;
    -
    -import javax.net.ssl.TrustManager;
    -import javax.net.ssl.TrustManagerFactory;
    -import javax.net.ssl.X509TrustManager;
    -import javax.security.auth.x500.X500Principal;
     
    +import org.bouncycastle.asn1.pkcs.PrivateKeyInfo;
     import org.bouncycastle.jce.X509Principal;
     import org.bouncycastle.jce.provider.BouncyCastleProvider;
    +import org.bouncycastle.openssl.PEMDecryptorProvider;
    +import org.bouncycastle.openssl.PEMEncryptedKeyPair;
    +import org.bouncycastle.openssl.PEMKeyPair;
    +import org.bouncycastle.openssl.PEMParser;
     import org.bouncycastle.openssl.PEMReader;
     import org.bouncycastle.openssl.PEMWriter;
     import org.bouncycastle.openssl.PasswordFinder;
    +import org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter;
    +import org.bouncycastle.openssl.jcajce.JcePEMDecryptorProviderBuilder;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
     
     import brooklyn.util.exceptions.Exceptions;
    +import brooklyn.util.stream.Streams;
     
    +import com.google.common.base.Objects;
     import com.google.common.base.Throwables;
     
     /**
      * Utility methods for generating and working with keys
      */
    -public class SecureKeys {
    +public class SecureKeys extends SecureKeysWithoutBouncyCastle {
     
    +    private static final Logger log = LoggerFactory.getLogger(SecureKeys.class);
    +    
         static { Security.addProvider(new BouncyCastleProvider()); }
    --- End diff --
    
    sub-classing should be an "is-a" relationship. If not that, then other mechanisms of code-reuse
are perhaps more appropriate. This at least deserves a comment in the javadoc of the class.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message