Class PropertyToPrivateKeyConverter
java.lang.Object
se.swedenconnect.security.credential.converters.PropertyToPrivateKeyConverter
- All Implemented Interfaces:
Aware
,ApplicationContextAware
,Converter<String,
PrivateKey>
public class PropertyToPrivateKeyConverter
extends Object
implements Converter<String,PrivateKey>, ApplicationContextAware
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
-
convert
- Specified by:
convert
in interfaceConverter<String,
PrivateKey>
-
setApplicationContext
- Specified by:
setApplicationContext
in interfaceApplicationContextAware
- Throws:
BeansException
-