@ExperimentalApi(value="https://github.com/grpc/grpc-java/issues/8024") public final class CertificateUtils extends Object
| Constructor and Description |
|---|
CertificateUtils() |
| Modifier and Type | Method and Description |
|---|---|
static PrivateKey |
getPrivateKey(InputStream inputStream)
Generates a
PrivateKey from a PEM file. |
static X509Certificate[] |
getX509Certificates(InputStream inputStream)
Generates X509Certificate array from a PEM file.
|
public static X509Certificate[] getX509Certificates(InputStream inputStream) throws CertificateException
inputStream - is a InputStream from the certificate filesCertificateExceptionpublic static PrivateKey getPrivateKey(InputStream inputStream) throws UnsupportedEncodingException, IOException, NoSuchAlgorithmException, InvalidKeySpecException
PrivateKey from a PEM file.
The key should be PKCS #8 formatted. The key algorithm should be "RSA" or "EC".
The PEM file should contain one item in Base64 encoding, with plain-text headers and footers
(e.g. -----BEGIN PRIVATE KEY----- and -----END PRIVATE KEY-----).inputStream - is a InputStream from the private key fileUnsupportedEncodingExceptionIOExceptionNoSuchAlgorithmExceptionInvalidKeySpecException