private static Credential getSigningCredential ( final Resource resource ) { try ( val inputStream = resource . getInputStream ( ) ) { val certificateFactory = CertificateFactory . getInstance ( "X.509" ) ; val certificate = ( X509Certificate ) certificateFactory . generateCertificate ( inputStream ) ; val publicCredential = new BasicX509Credential ( certificate ) ; LOGGER . debug ( "Signing credential key retrieved from [{}]." , resource ) ; return publicCredential ; } catch ( final Exception ex ) { LOGGER . error ( ex . getMessage ( ) , ex ) ; } return null ; }
getSigningCredential loads up an X509Credential from a file .