Class RsaKeyConverters


  • public final class RsaKeyConverters
    extends java.lang.Object
    Used for creating Key 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 a Converter for converting a PEM-encoded PKCS#8 RSA Private Key into a RSAPrivateKey.
      static org.springframework.core.convert.converter.Converter<java.io.InputStream,​java.security.interfaces.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 Detail

      • pkcs8

        public static org.springframework.core.convert.converter.Converter<java.io.InputStream,​java.security.interfaces.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<java.io.InputStream,​java.security.interfaces.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.