Package org.springframework.security.converter

# Class RsaKeyConverters

java.lang.Object
org.springframework.security.converter.RsaKeyConverters

public final class RsaKeyConverters extends Object
Used for creating `Key` converter instances

Since:
  5.2

## Method Summary

Modifier and Type
Method
Description
`static org.springframework.core.convert.converter.Converter<InputStream,RSAPrivateKey>`
`pkcs8()`
Construct a `Converter` for converting a PEM-encoded PKCS#8 RSA Private Key into a `RSAPrivateKey`.
`static org.springframework.core.convert.converter.Converter<InputStream,RSAPublicKey>`
`x509()`
Construct a `Converter` for converting a PEM-encoded X.509 RSA Public Key or X.509 Certificate into a `RSAPublicKey`.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Method Details

### pkcs8

public static org.springframework.core.convert.converter.Converter<InputStream,RSAPrivateKey> pkcs8()
Construct a `Converter` for converting a PEM-encoded PKCS#8 RSA Private Key into a `RSAPrivateKey`. 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 the `InputStream` 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 a `RSAPrivateKey`.

### x509

public static org.springframework.core.convert.converter.Converter<InputStream,RSAPublicKey> x509()
Construct a `Converter` for converting a PEM-encoded X.509 RSA Public Key or X.509 Certificate into a `RSAPublicKey`. This converter does not close the `InputStream` 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 a `RSAPublicKey`.