Skip to content

Latest commit

 

History

History
242 lines (153 loc) · 5.11 KB

crypto.rst

File metadata and controls

242 lines (153 loc) · 5.11 KB

:pycrypto --- Generic cryptographic module

Note

pyca/cryptography is likely a better choice than using this module. It contains a complete set of cryptographic primitives as well as a significantly better and more powerful X509 API. If necessary you can convert to and from cryptography objects using the to_cryptography and from_cryptography methods on X509, X509Req, CRL, and PKey.

Elliptic curves

get_elliptic_curves

get_elliptic_curve

Serialization and deserialization

The following serialization functions take one of these constants to determine the format.

FILETYPE_PEM serializes data to a Base64-encoded encoded representation of the underlying ASN.1 data structure. This representation includes delimiters that define what data structure is contained within the Base64-encoded block: for example, for a certificate, the delimiters are -----BEGIN CERTIFICATE----- and -----END CERTIFICATE-----.

FILETYPE_ASN1 serializes data to the underlying ASN.1 data structure. The format used by FILETYPE_ASN1 is also sometimes referred to as DER.

Certificates

dump_certificate

load_certificate

Certificate signing requests

dump_certificate_request

load_certificate_request

Private keys

dump_privatekey

load_privatekey

Public keys

dump_publickey

load_publickey

Certificate revocation lists

dump_crl

load_crl

load_pkcs7_data

load_pkcs12

Signing and verifying signatures

sign

verify

X509 objects

X509

X509Name objects

X509Name

X509Req objects

X509Req

X509Store objects

X509Store

X509StoreContextError objects

X509StoreContextError

X509StoreContext objects

X509StoreContext

X509StoreFlags constants

X509StoreFlags

CRL_CHECK

CRL_CHECK_ALL

IGNORE_CRITICAL

X509_STRICT

ALLOW_PROXY_CERTS

POLICY_CHECK

EXPLICIT_POLICY

INHIBIT_MAP

NOTIFY_POLICY

CHECK_SS_SIGNATURE

PARTIAL_CHAIN

PKey objects

PKey

Key type constants.

PKCS7 objects

PKCS7 objects have the following methods:

PKCS7

PKCS12 objects

PKCS12

X509Extension objects

X509Extension

NetscapeSPKI objects

NetscapeSPKI

CRL objects

CRL

Revoked objects

Revoked

Exceptions

Digest names

Several of the functions and methods in this module take a digest name. These must be strings describing a digest algorithm supported by OpenSSL (by EVP_get_digestbyname, specifically). For example, b"sha256" or b"sha384".

More information and a list of these digest names can be found in the EVP_DigestInit(3) man page of your OpenSSL installation. This page can be found online for the latest version of OpenSSL: https://www.openssl.org/docs/manmaster/man3/EVP_DigestInit.html