def openssl_verify(cafile, certificatefile, **kwargs):
 command = ['openssl', 'verify', '-CAfile', cafile, certificatefile]
 try:
  result = run_process(command, **kwargs)
  return (result.output.strip() == '{}: OK'.format(certificatefile))
 except CalledProcessError as e:
  result = run_process(['openssl', 'x509', '-text', '-in', cafile], **kwargs)
  cafile_info = result.output
  result = run_process(['openssl', 'x509', '-text', '-in', certificatefile], **kwargs)
  certificate_info = result.output
  error = str(e)
  error = ((((error + '\n') + cafile_info) + '\n') + certificate_info)
  Message.new(message_type='flocker.ca.functional:openssl_verify_error', error=error).write(Logger())
  return False

def openssl_verify ( cafile , certificatefile , ** kwargs ) : command = [ 'openssl' , 'verify' , '-CAfile' , cafile , certificatefile ] try : result = run_process ( command , ** kwargs ) return ( result . output . strip ( ) == '{}: OK' . format ( certificatefile ) ) except CalledProcessError as e : result = run_process ( [ 'openssl' , 'x509' , '-text' , '-in' , cafile ] , ** kwargs ) cafile_info = result . output result = run_process ( [ 'openssl' , 'x509' , '-text' , '-in' , certificatefile ] , ** kwargs ) certificate_info = result . output error = str ( e ) error = ( ( ( ( error + '\n' ) + cafile_info ) + '\n' ) + certificate_info ) Message . new ( message_type = 'flocker.ca.functional:openssl_verify_error' , error = error ) . write ( Logger ( ) ) return False
use openssl cli to verify a certificate was signed by a given certificate authority .