@ExperimentalApi(value="https://github.com/grpc/grpc-java/issues/8024")
public final class CertificateUtils
extends java.lang.Object
| Constructor and Description |
|---|
CertificateUtils() |
| Modifier and Type | Method and Description |
|---|---|
static java.security.PrivateKey |
getPrivateKey(java.io.InputStream inputStream)
Generates a
PrivateKey from a PEM file. |
static java.security.cert.X509Certificate[] |
getX509Certificates(java.io.InputStream inputStream)
Generates X509Certificate array from a PEM file.
|
public static java.security.cert.X509Certificate[] getX509Certificates(java.io.InputStream inputStream)
throws java.security.cert.CertificateException
inputStream - is a InputStream from the certificate filesjava.security.cert.CertificateExceptionpublic static java.security.PrivateKey getPrivateKey(java.io.InputStream inputStream)
throws java.io.UnsupportedEncodingException,
java.io.IOException,
java.security.NoSuchAlgorithmException,
java.security.spec.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 filejava.io.UnsupportedEncodingExceptionjava.io.IOExceptionjava.security.NoSuchAlgorithmExceptionjava.security.spec.InvalidKeySpecException