Package io.grpc.util
Class CertificateUtils
- java.lang.Object
-
- io.grpc.util.CertificateUtils
-
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/8024") public final class CertificateUtils extends Object
Contains certificate/key PEM file utility method(s).
-
-
Constructor Summary
Constructors Constructor Description CertificateUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static PrivateKey
getPrivateKey(InputStream inputStream)
Generates aPrivateKey
from a PEM file.static X509Certificate[]
getX509Certificates(InputStream inputStream)
Generates X509Certificate array from a PEM file.
-
-
-
Method Detail
-
getX509Certificates
public static X509Certificate[] getX509Certificates(InputStream inputStream) throws CertificateException
Generates X509Certificate array from a PEM file. The PEM file should contain one or more items in Base64 encoding, each with plain-text headers and footers (e.g. -----BEGIN CERTIFICATE----- and -----END CERTIFICATE-----).- Parameters:
inputStream
- is aInputStream
from the certificate files- Throws:
CertificateException
-
getPrivateKey
public static PrivateKey getPrivateKey(InputStream inputStream) throws UnsupportedEncodingException, IOException, NoSuchAlgorithmException, InvalidKeySpecException
Generates aPrivateKey
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-----).- Parameters:
inputStream
- is aInputStream
from the private key file- Throws:
UnsupportedEncodingException
IOException
NoSuchAlgorithmException
InvalidKeySpecException
-
-