public class SecureKeys extends SecureKeysWithoutBouncyCastle
Modifier and Type | Class and Description |
---|---|
static class |
SecureKeys.PassphraseProblem |
Modifier and Type | Method and Description |
---|---|
static boolean |
equal(java.security.KeyPair k1,
java.security.KeyPair k2)
because KeyPair.equals is not implemented :(
|
static java.security.PublicKey |
fromPub(java.lang.String pubText)
opposite of
toPub(KeyPair) , given text |
static org.bouncycastle.jce.X509Principal |
getX509PrincipalWithCommonName(java.lang.String commonName)
RFC1773 order, with None for other values.
|
static void |
initBouncyCastleProvider() |
static java.security.KeyPair |
readPem(byte[] key,
java.lang.String passphrase)
reads RSA or DSA / pem style private key files (viz
toPem(KeyPair) ), extracting also the public key if possible. |
static java.security.KeyPair |
readPem(java.io.InputStream input,
java.lang.String passphrase)
Deprecated.
since 0.10.0 - use
readPem(byte[], String) instead |
static java.lang.String |
toPem(java.security.KeyPair key)
returns the PEM (base64, ie for id_rsa) string for the private key / key pair;
this starts -----BEGIN PRIVATE KEY----- and ends similarly, like id_rsa.
|
static java.lang.String |
toPub(java.security.KeyPair key)
returns id_rsa.pub style file, of public key
|
getCanonicalImpl, getTrustManager, getTrustManager, getTrustManager, getX500PrincipalWithCommonName, isCertificateAuthorizedBy, isCertificateAuthorizedBy, newKeyPair, newKeyPair, newKeyPairGenerator, newKeyStore, newKeyStore
public static void initBouncyCastleProvider()
public static org.bouncycastle.jce.X509Principal getX509PrincipalWithCommonName(java.lang.String commonName)
@Deprecated public static java.security.KeyPair readPem(java.io.InputStream input, java.lang.String passphrase)
readPem(byte[], String)
insteadpublic static java.security.KeyPair readPem(byte[] key, java.lang.String passphrase)
toPem(KeyPair)
), extracting also the public key if possible. Closes the stream.java.lang.IllegalStateException
- on errors, in particular SecureKeys.PassphraseProblem
if that is the problempublic static boolean equal(java.security.KeyPair k1, java.security.KeyPair k2)
public static java.lang.String toPem(java.security.KeyPair key)
readPem(byte[], String)
public static java.lang.String toPub(java.security.KeyPair key)
public static java.security.PublicKey fromPub(java.lang.String pubText)
toPub(KeyPair)
, given text