@Beta public class Pems extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Pems.PemProcessor<T> |
Modifier and Type | Field and Description |
---|---|
static String |
CERTIFICATE_X509_MARKER |
static String |
PRIVATE_PKCS1_MARKER |
static String |
PRIVATE_PKCS8_MARKER |
static String |
PUBLIC_PKCS1_MARKER |
static String |
PUBLIC_X509_MARKER |
Constructor and Description |
---|
Pems() |
Modifier and Type | Method and Description |
---|---|
static <T> T |
fromPem(com.google.common.io.InputSupplier<? extends InputStream> supplier,
Pems.PemProcessor<T> processor)
Returns the object of generic type
T that is pem encoded in the
supplier. |
static byte[] |
getEncoded(RSAPrivateCrtKey key) |
static String |
pem(PrivateKey key)
encodes the
PrivateKey to PEM format. |
static String |
pem(PublicKey key)
encodes the
PublicKey to PEM format. |
static String |
pem(X509Certificate cert)
encodes the
X509Certificate to PEM format. |
static KeySpec |
privateKeySpec(com.google.common.io.InputSupplier<? extends InputStream> supplier)
Returns the
RSAPrivateKeySpec that is pem encoded in the supplier. |
static KeySpec |
privateKeySpec(String pem)
Executes
privateKeySpec(InputSupplier) on the string which
contains an encoded private key in PEM format. |
static KeySpec |
publicKeySpec(com.google.common.io.InputSupplier<? extends InputStream> supplier)
Returns the
KeySpec that is pem encoded in the supplier. |
static KeySpec |
publicKeySpec(String pem)
Executes
publicKeySpec(InputSupplier) on the string which
contains an encoded public key in PEM format. |
static X509Certificate |
x509Certificate(com.google.common.io.InputSupplier<? extends InputStream> supplier,
CertificateFactory certFactory)
Returns the
X509EncodedKeySpec that is pem encoded in the
supplier. |
static X509Certificate |
x509Certificate(String pem)
Executes
x509Certificate(InputSupplier, CertificateFactory)
on the string which contains an X.509 certificate in PEM format. |
public static final String PRIVATE_PKCS1_MARKER
public static final String PRIVATE_PKCS8_MARKER
public static final String CERTIFICATE_X509_MARKER
public static final String PUBLIC_X509_MARKER
public static final String PUBLIC_PKCS1_MARKER
public static <T> T fromPem(com.google.common.io.InputSupplier<? extends InputStream> supplier, Pems.PemProcessor<T> processor) throws IOException
T
that is pem encoded in the
supplier.supplier
- the input stream factorymarker
- header that begins the PEM blockprocessor
- how to parser the object from a byte arrayT
which was PEM encoded in the
streamIOException
- if an I/O error occurspublic static KeySpec privateKeySpec(com.google.common.io.InputSupplier<? extends InputStream> supplier) throws IOException
RSAPrivateKeySpec
that is pem encoded in the supplier.supplier
- the input stream factoryRSAPrivateKeySpec
which was PEM encoded in the streamIOException
- if an I/O error occurspublic static KeySpec privateKeySpec(String pem)
privateKeySpec(InputSupplier)
on the string which
contains an encoded private key in PEM format.pem
- private key in pem encoded format.privateKeySpec(InputSupplier)
public static KeySpec publicKeySpec(com.google.common.io.InputSupplier<? extends InputStream> supplier) throws IOException
KeySpec
that is pem encoded in the supplier.supplier
- the input stream factoryKeySpec
which was PEM encoded in the streamIOException
- if an I/O error occurspublic static KeySpec publicKeySpec(String pem) throws IOException
publicKeySpec(InputSupplier)
on the string which
contains an encoded public key in PEM format.pem
- public key in pem encoded format.IOException
publicKeySpec(InputSupplier)
public static X509Certificate x509Certificate(com.google.common.io.InputSupplier<? extends InputStream> supplier, @Nullable CertificateFactory certFactory) throws IOException, CertificateException
X509EncodedKeySpec
that is pem encoded in the
supplier.supplier
- the input stream factorycertFactory
- or null to use defaultX509EncodedKeySpec
which was PEM encoded in the streamIOException
- if an I/O error occursCertificateException
public static X509Certificate x509Certificate(String pem) throws IOException, CertificateException
x509Certificate(InputSupplier, CertificateFactory)
on the string which contains an X.509 certificate in PEM format.pem
- certificate in pem encoded format.IOException
CertificateException
x509Certificate(InputSupplier, CertificateFactory)
public static String pem(X509Certificate cert) throws CertificateEncodingException
X509Certificate
to PEM format.cert
- what to encodeIOException
CertificateEncodingException
public static String pem(PublicKey key)
PublicKey
to PEM format.cert
- what to encodeIOException
CertificateEncodingException
public static String pem(PrivateKey key)
PrivateKey
to PEM format. Notecert
- what to encodeIOException
CertificateEncodingException
public static byte[] getEncoded(RSAPrivateCrtKey key)
Copyright © 2009-2012 jclouds. All Rights Reserved.