keystoneclient/common/cms.py
def cms_verify(formatted, signing_cert_file_name, ca_file_name,
               inform=PKI_ASN1_FORM):
    """Verifies the signature of the contents IAW CMS syntax.

    :raises subprocess.CalledProcessError:
    :raises keystoneclient.exceptions.CertificateConfigError: if certificate
                                                              is not configured
                                                              properly.
    """
    _ensure_subprocess()
    if isinstance(formatted, six.string_types):
        data = bytearray(formatted, _encoding_for_form(inform))
    else:
        data = formatted
    process = subprocess.Popen(['openssl', 'cms', '-verify',
                                '-certfile', signing_cert_file_name,
                                '-CAfile', ca_file_name,
                                '-inform', 'PEM',
                                '-nosmimecap', '-nodetach',
                                '-nocerts', '-noattr'],
                               stdin=subprocess.PIPE,
                               stdout=subprocess.PIPE,
                               stderr=subprocess.PIPE,
                               close_fds=True)
    output, err, retcode = _process_communicate_handle_oserror(
        process, data, (signing_cert_file_name, ca_file_name))

    # Do not log errors, as some happen in the positive thread
    # instead, catch them in the calling code and log them there.

    # When invoke the openssl with not exist file, return code 2
    # and error msg will be returned.
    # You can get more from
    # http://www.openssl.org/docs/apps/cms.html#EXIT_CODES
    #
    # $ openssl cms -verify -certfile not_exist_file -CAfile \
    #       not_exist_file -inform PEM -nosmimecap -nodetach \
    #       -nocerts -noattr
    # Error opening certificate file not_exist_file
    #
    if retcode == OpensslCmsExitStatus.INPUT_FILE_READ_ERROR:
        if err.startswith('Error reading S/MIME message'):
            raise exceptions.CMSError(err)
        else:
            raise exceptions.CertificateConfigError(err)
    elif retcode != OpensslCmsExitStatus.SUCCESS:
        # NOTE(dmllr): Python 2.6 compatibility:
        # CalledProcessError did not have output keyword argument
        e = subprocess.CalledProcessError(retcode, 'openssl')
        e.output = err
        raise e
    return output
Verifies the signature of the contents IAW CMS syntax.

    :raises subprocess.CalledProcessError:
    :raises keystoneclient.exceptions.CertificateConfigError: if certificate
                                                              is not configured
                                                              properly.
    
Verifies the signature of the contents IAW CMS syntax.
Verifies the signature of the contents IAW CMS syntax .
def cms_verify(formatted, signing_cert_file_name, ca_file_name,
               inform=PKI_ASN1_FORM):
    _ensure_subprocess()
    if isinstance(formatted, six.string_types):
        data = bytearray(formatted, _encoding_for_form(inform))
    else:
        data = formatted
    process = subprocess.Popen(['openssl', 'cms', '-verify',
                                '-certfile', signing_cert_file_name,
                                '-CAfile', ca_file_name,
                                '-inform', 'PEM',
                                '-nosmimecap', '-nodetach',
                                '-nocerts', '-noattr'],
                               stdin=subprocess.PIPE,
                               stdout=subprocess.PIPE,
                               stderr=subprocess.PIPE,
                               close_fds=True)
    output, err, retcode = _process_communicate_handle_oserror(
        process, data, (signing_cert_file_name, ca_file_name))
     $ openssl cms -verify -certfile not_exist_file -CAfile \
           not_exist_file -inform PEM -nosmimecap -nodetach \
           -nocerts -noattr
     Error opening certificate file not_exist_file
    if retcode == OpensslCmsExitStatus.INPUT_FILE_READ_ERROR:
        if err.startswith('Error reading S/MIME message'):
            raise exceptions.CMSError(err)
        else:
            raise exceptions.CertificateConfigError(err)
    elif retcode != OpensslCmsExitStatus.SUCCESS:
         NOTE(dmllr): Python 2.6 compatibility:
         CalledProcessError did not have output keyword argument
        e = subprocess.CalledProcessError(retcode, 'openssl')
        e.output = err
        raise e
    return output
def cms_verify ( formatted , signing_cert_file_name , ca_file_name , inform = PKI_ASN1_FORM ) : _ensure_subprocess ( ) if isinstance ( formatted , six . string_types ) : data = bytearray ( formatted , _encoding_for_form ( inform ) ) else : data = formatted process = subprocess . Popen ( [ 'openssl' , 'cms' , '-verify' , '-certfile' , signing_cert_file_name , '-CAfile' , ca_file_name , '-inform' , 'PEM' , '-nosmimecap' , '-nodetach' , '-nocerts' , '-noattr' ] , stdin = subprocess . PIPE , stdout = subprocess . PIPE , stderr = subprocess . PIPE , close_fds = True ) output , err , retcode = _process_communicate_handle_oserror ( process , data , ( signing_cert_file_name , ca_file_name ) ) if retcode == OpensslCmsExitStatus . INPUT_FILE_READ_ERROR : if err . startswith ( 'Error reading S/MIME message' ) : raise exceptions . CMSError ( err ) else : raise exceptions . CertificateConfigError ( err ) elif retcode != OpensslCmsExitStatus . SUCCESS : e = subprocess . CalledProcessError ( retcode , 'openssl' ) e . output = err raise e return output
Verifies the signature of the contents IAW CMS syntax.
Verifies the signature of the contents IAW CMS syntax .
"""Verifies the signature of the contents IAW CMS syntax.

    :raises subprocess.CalledProcessError:
    :raises keystoneclient.exceptions.CertificateConfigError: if certificate
                                                              is not configured
                                                              properly.
    """ # Do not log errors, as some happen in the positive thread # instead, catch them in the calling code and log them there. # When invoke the openssl with not exist file, return code 2 # and error msg will be returned. # You can get more from # http://www.openssl.org/docs/apps/cms.html#EXIT_CODES # # $ openssl cms -verify -certfile not_exist_file -CAfile \ #       not_exist_file -inform PEM -nosmimecap -nodetach \ #       -nocerts -noattr # Error opening certificate file not_exist_file # # NOTE(dmllr): Python 2.6 compatibility: # CalledProcessError did not have output keyword argument
None
subprocess.CalledProcessError
if certificate
is not configured
properly.
if certificate is not configured properly .
keystoneclient.exceptions.CertificateConfigError
formatted
signing_cert_file_name
ca_file_name
inform