Class PropertyToPrivateKeyConverter

java.lang.Object
se.swedenconnect.security.credential.spring.converters.AbstractResourcePropertyConverter<PrivateKey>
se.swedenconnect.security.credential.spring.converters.PropertyToPrivateKeyConverter
All Implemented Interfaces:
Aware, ApplicationContextAware, Converter<String,PrivateKey>

public class PropertyToPrivateKeyConverter extends AbstractResourcePropertyConverter<PrivateKey>
A Converter that gets the property value (e.g., classpath:signing.key) and instantiates a PrivateKey object.

Note: The converter only handles non-encrypted private keys in DER, PEM, and PKCS#8 formats.

To use this converter it has to be instantiated as a bean and then registered in the registry using ConverterRegistry.addConverter(Converter).

If you are using Spring Boot, do:

 @Bean
 @ConfigurationPropertiesBinding
 public PropertyToPrivateKeyConverter propertyToPrivateKeyConverter() {
   return new PropertyToPrivateKeyConverter();
 }
 
Author:
Martin Lindström (martin@idsec.se), Stefan Santesson (stefan@idsec.se)
  • Constructor Details

    • PropertyToPrivateKeyConverter

      public PropertyToPrivateKeyConverter()
  • Method Details