Class RsaKeyConverters
- java.lang.Object
-
- org.springframework.security.converter.RsaKeyConverters
-
public final class RsaKeyConverters extends java.lang.Object
Used for creatingKey
converter instances- Since:
- 5.2
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.springframework.core.convert.converter.Converter<java.io.InputStream,java.security.interfaces.RSAPrivateKey>
pkcs8()
Construct aConverter
for converting a PEM-encoded PKCS#8 RSA Private Key into aRSAPrivateKey
.static org.springframework.core.convert.converter.Converter<java.io.InputStream,java.security.interfaces.RSAPublicKey>
x509()
Construct aConverter
for converting a PEM-encoded X.509 RSA Public Key or X.509 Certificate into aRSAPublicKey
.
-
-
-
Method Detail
-
pkcs8
public static org.springframework.core.convert.converter.Converter<java.io.InputStream,java.security.interfaces.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
public static org.springframework.core.convert.converter.Converter<java.io.InputStream,java.security.interfaces.RSAPublicKey> 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
.
-
-