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>
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconvert(InputStream inputStream) Converts the input stream to the object supported by the converter.protected booleanisInlinedPem(String property) Tells whether the property value holds an "inlined" PEM representation of the object.Methods inherited from class se.swedenconnect.security.credential.spring.converters.AbstractResourcePropertyConverter
convert, setApplicationContext
-
Constructor Details
-
PropertyToPrivateKeyConverter
public PropertyToPrivateKeyConverter()
-
-
Method Details
-
convert
Converts the input stream to the object supported by the converter.The stream must not be closed.
- Specified by:
convertin classAbstractResourcePropertyConverter<PrivateKey>- Parameters:
inputStream- the stream- Returns:
- the object
- Throws:
KeyException
-
isInlinedPem
Tells whether the property value holds an "inlined" PEM representation of the object.- Specified by:
isInlinedPemin classAbstractResourcePropertyConverter<PrivateKey>- Parameters:
property- the property value- Returns:
trueif the property holds a PEM object, andfalseotherwise
-