Class RsaKeyConverters
java.lang.Object
org.springframework.security.converter.RsaKeyConverters
Used for creating
Key
converter instances- Since:
- 5.2
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.springframework.core.convert.converter.Converter<InputStream,
RSAPrivateKey> pkcs8()
Construct aConverter
for converting a PEM-encoded PKCS#8 RSA Private Key into aRSAPrivateKey
.static org.springframework.core.convert.converter.Converter<InputStream,
RSAPublicKey> x509()
Construct aConverter
for converting a PEM-encoded X.509 RSA Public Key or X.509 Certificate into aRSAPublicKey
.
-
Method Details
-
pkcs8
public static org.springframework.core.convert.converter.Converter<InputStream,RSAPrivateKey> pkcs8()Construct aConverter
for converting a PEM-encoded PKCS#8 RSA Private Key into aRSAPrivateKey
. Note that keys are often formatted in PKCS#1 and this can easily be identified by the header. If the key file begins with "-----BEGIN RSA PRIVATE KEY-----", then it is PKCS#1. If it is PKCS#8 formatted, then it begins with "-----BEGIN PRIVATE KEY-----". This converter does not close theInputStream
in order to avoid making non-portable assumptions about the streams' origin and further use.- Returns:
- A
Converter
that can read a PEM-encoded PKCS#8 RSA Private Key and return aRSAPrivateKey
.
-
x509
Construct aConverter
for converting a PEM-encoded X.509 RSA Public Key or X.509 Certificate into aRSAPublicKey
. This converter does not close theInputStream
in order to avoid making non-portable assumptions about the streams' origin and further use.- Returns:
- A
Converter
that can read a PEM-encoded X.509 RSA Public Key and return aRSAPublicKey
.
-