我们从Python开源项目中,提取了以下16个代码示例,用于说明如何使用cryptography.x509.SubjectKeyIdentifier()。
def _cert_builder_common(subject, issuer, public_key): return ( x509.CertificateBuilder() .subject_name(subject) .issuer_name(issuer) .public_key(public_key) .not_valid_before(datetime.datetime(2000, 1, 1)) # OpenSSL on Windows freaks out if you try to give it a date after # ~3001-01-19 # https://github.com/pyca/cryptography/issues/3194 .not_valid_after(datetime.datetime(3000, 1, 1)) .serial_number(x509.random_serial_number()) .add_extension( x509.SubjectKeyIdentifier.from_public_key(public_key), critical=False, ) )
def _decode_subject_key_identifier(backend, asn1_string): asn1_string = backend._ffi.cast("ASN1_OCTET_STRING *", asn1_string) asn1_string = backend._ffi.gc( asn1_string, backend._lib.ASN1_OCTET_STRING_free ) return x509.SubjectKeyIdentifier( backend._ffi.buffer(asn1_string.data, asn1_string.length)[:] )