def _create_ocsp_request(issuer, subject):
    """
    Create CertId and OCSPRequest
    """
    cert_id = CertId({
        'hash_algorithm':
        DigestAlgorithm({
            'algorithm': u'sha1',
            'parameters': None
        }),
        'issuer_name_hash':
        OctetString(subject.issuer.sha1),
        'issuer_key_hash':
        OctetString(issuer.public_key.sha1),
        'serial_number':
        subject.serial_number,
    })
    req = OCSPRequest({
        'tbs_request':
        TBSRequest({
            'version':
            Version(0),
            'request_list':
            Requests([Request({
                'req_cert': cert_id,
            })]),
        }),
    })
    return cert_id, req
Example #2
0
 def create_ocsp_request(self, issuer, subject):
     """Creates CertId and OCSPRequest."""
     cert_id = CertId({
         "hash_algorithm":
         DigestAlgorithm({
             "algorithm": "sha1",
             "parameters": None
         }),
         "issuer_name_hash":
         OctetString(subject.issuer.sha1),
         "issuer_key_hash":
         OctetString(issuer.public_key.sha1),
         "serial_number":
         subject.serial_number,
     })
     ocsp_request = OCSPRequest({
         "tbs_request":
         TBSRequest({
             "version":
             Version(0),
             "request_list":
             Requests([Request({
                 "req_cert": cert_id,
             })]),
         }),
     })
     return cert_id, ocsp_request