Class PropertyToX509CertificateConverter

java.lang.Object
se.idsec.signservice.integration.config.spring.PropertyToX509CertificateConverter
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware, org.springframework.core.convert.converter.Converter<String,X509Certificate>

public class PropertyToX509CertificateConverter extends Object implements org.springframework.core.convert.converter.Converter<String,X509Certificate>, org.springframework.context.ApplicationContextAware
For Spring Framework users. A Converter that gets the property value (e.g., classpath:cert.crt) and instantiates a X509Certificate onbject.

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 PropertyToX509CertificateConverter propertyToX509CertificateConverter() {
   return new PropertyToX509CertificateConverter();
 }
 
Author:
Martin Lindström (martin@idsec.se), Stefan Santesson (stefan@idsec.se)
  • Constructor Details

    • PropertyToX509CertificateConverter

      public PropertyToX509CertificateConverter()
  • Method Details

    • convert

      public X509Certificate convert(@Nonnull String source)
      Specified by:
      convert in interface org.springframework.core.convert.converter.Converter<String,X509Certificate>
    • setApplicationContext

      public void setApplicationContext(@Nonnull org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
      Specified by:
      setApplicationContext in interface org.springframework.context.ApplicationContextAware
      Throws:
      org.springframework.beans.BeansException