Brooklyn

brooklyn.util.crypto
[Java] Class SecureKeys

java.lang.Object
  brooklyn.util.crypto.SecureKeys

public class SecureKeys

Utility methods for generating and working with keys


Method Summary
static java.security.cert.X509Certificate getCanonicalImpl(java.security.cert.X509Certificate inCert)

converts a certificate to the canonical implementation, commonly sun.security.x509.X509CertImpl, which is required in some places -- the Bouncy Castle X509 impl is not accepted (e.g. where certs are chained, passed to trust manager)

static javax.net.ssl.TrustManager getTrustManager(java.security.KeyStore trustStore)

see getTrustManager(KeyStore, Class), matching any type

static java.lang.Object getTrustManager(java.security.KeyStore trustStore, java.lang.Class type)

returns the trust manager inferred from trustStore, matching the type (if not null); throws exception if there are none, or if there are multiple

static javax.net.ssl.X509TrustManager getTrustManager(java.security.cert.X509Certificate certificate)

static javax.security.auth.x500.X500Principal getX500PrincipalWithCommonName(java.lang.String commonName)

static X509Principal getX509PrincipalWithCommonName(java.lang.String commonName)

RFC1773 order, with None for other values.

static boolean isCertificateAuthorizedBy(java.security.cert.X509Certificate candidate, java.security.cert.X509Certificate authority)

static java.security.KeyPair newKeyPair()

static java.security.KeyPair newKeyPair(java.lang.String algorithm, int bits)

static java.security.KeyPairGenerator newKeyPairGenerator(java.lang.String algorithm, int bits)

static java.security.KeyStore newKeyStore()

returns a new keystore, of the default type, and initialized to be empty.

static java.security.KeyStore newKeyStore(java.io.InputStream source, java.lang.String passphrase)

returns keystore of default type read from given source

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Method Detail

getCanonicalImpl

public static java.security.cert.X509Certificate getCanonicalImpl(java.security.cert.X509Certificate inCert)
converts a certificate to the canonical implementation, commonly sun.security.x509.X509CertImpl, which is required in some places -- the Bouncy Castle X509 impl is not accepted (e.g. where certs are chained, passed to trust manager)


getTrustManager

public static javax.net.ssl.TrustManager getTrustManager(java.security.KeyStore trustStore)
see getTrustManager(KeyStore, Class), matching any type


getTrustManager

@SuppressWarnings("unchecked")
public static java.lang.Object getTrustManager(java.security.KeyStore trustStore, java.lang.Class type)
returns the trust manager inferred from trustStore, matching the type (if not null); throws exception if there are none, or if there are multiple


getTrustManager

public static javax.net.ssl.X509TrustManager getTrustManager(java.security.cert.X509Certificate certificate)


getX500PrincipalWithCommonName

public static javax.security.auth.x500.X500Principal getX500PrincipalWithCommonName(java.lang.String commonName)


getX509PrincipalWithCommonName

public static X509Principal getX509PrincipalWithCommonName(java.lang.String commonName)
RFC1773 order, with None for other values. Normally prefer X500Principal.


isCertificateAuthorizedBy

public static boolean isCertificateAuthorizedBy(java.security.cert.X509Certificate candidate, java.security.cert.X509Certificate authority)


newKeyPair

public static java.security.KeyPair newKeyPair()


newKeyPair

public static java.security.KeyPair newKeyPair(java.lang.String algorithm, int bits)


newKeyPairGenerator

public static java.security.KeyPairGenerator newKeyPairGenerator(java.lang.String algorithm, int bits)


newKeyStore

public static java.security.KeyStore newKeyStore()
returns a new keystore, of the default type, and initialized to be empty. (everyone always forgets to load(null,null).)


newKeyStore

public static java.security.KeyStore newKeyStore(java.io.InputStream source, java.lang.String passphrase)
returns keystore of default type read from given source


 

Brooklyn Multi-Cloud Application Management Platform
brooklyncentral.github.com. Apache License. © 2012.