massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / coc-python-data / languageServer.0.5.59 / Typeshed / third_party / 2 / OpenSSL / crypto.pyi
1 # Stubs for OpenSSL.crypto (Python 2)\r
2 \r
3 from typing import Any, Callable, Iterable, List, Optional, Set, Text, Tuple, Union\r
4 \r
5 from cryptography.hazmat.primitives.asymmetric import dsa, rsa\r
6 \r
7 FILETYPE_PEM = ...  # type: int\r
8 FILETYPE_ASN1 = ...  # type: int\r
9 FILETYPE_TEXT = ...  # type: int\r
10 TYPE_RSA = ...  # type: int\r
11 TYPE_DSA = ...  # type: int\r
12 \r
13 class Error(Exception): ...\r
14 \r
15 class PKey:\r
16     def __init__(self) -> None: ...\r
17     def to_cryptography_key(self) -> Union[rsa.RSAPublicKey, rsa.RSAPrivateKey, dsa.DSAPublicKey, dsa.DSAPrivateKey]: ...\r
18     @classmethod\r
19     def from_cryptography_key(cls, crypto_key: Union[rsa.RSAPublicKey, rsa.RSAPrivateKey, dsa.DSAPublicKey, dsa.DSAPrivateKey]): ...\r
20     def generate_key(self, type: int, bits: int) -> None: ...\r
21     def check(self) -> bool: ...\r
22     def type(self) -> int: ...\r
23     def bits(self) -> int: ...\r
24 \r
25 class _EllipticCurve:\r
26     name = ...  # type: Text\r
27 \r
28 def get_elliptic_curves() -> Set[_EllipticCurve]: ...\r
29 def get_elliptic_curve(name: str) -> _EllipticCurve: ...\r
30 \r
31 class X509Name:\r
32     def __init__(self, name: X509Name) -> None: ...\r
33     countryName = ...  # type: Union[str, unicode]\r
34     stateOrProvinceName = ...  # type: Union[str, unicode]\r
35     localityName = ...  # type: Union[str, unicode]\r
36     organizationName = ...  # type: Union[str, unicode]\r
37     organizationalUnitName = ...  # type: Union[str, unicode]\r
38     commonName = ...  # type: Union[str, unicode]\r
39     emailAddress = ...  # type: Union[str, unicode]\r
40     C = ...  # type: Union[str, unicode]\r
41     ST = ...  # type: Union[str, unicode]\r
42     L = ...  # type: Union[str, unicode]\r
43     O = ...  # type: Union[str, unicode]\r
44     OU = ...  # type: Union[str, unicode]\r
45     CN = ...  # type: Union[str, unicode]\r
46     def hash(self) -> int: ...\r
47     def der(self) -> bytes: ...\r
48     def get_components(self) -> List[Tuple[str, str]]: ...\r
49 \r
50 class X509Extension:\r
51     def __init__(self, type_name: bytes, critical: bool, value: bytes, subject: Optional[X509] = ..., issuer: Optional[X509] = ...) -> None: ...\r
52     def get_critical(self) -> bool: ...\r
53     def get_short_name(self) -> str: ...\r
54     def get_data(self) -> str: ...\r
55 \r
56 class X509Req:\r
57     def __init__(self) -> None: ...\r
58     def set_pubkey(self, pkey: PKey) -> None: ...\r
59     def get_pubkey(self) -> PKey: ...\r
60     def set_version(self, version: int) -> None: ...\r
61     def get_version(self) -> int: ...\r
62     def get_subject(self) -> X509Name: ...\r
63     def add_extensions(self, extensions: Iterable[X509Extension]) -> None: ...\r
64     def get_extensions(self) -> List[X509Extension]: ...\r
65     def sign(self, pkey: PKey, digest: str) -> None: ...\r
66     def verify(self, pkey: PKey) -> bool: ...\r
67 \r
68 class X509:\r
69     def __init__(self) -> None: ...\r
70     def set_version(self, version: int) -> None: ...\r
71     def get_version(self) -> int: ...\r
72     def get_pubkey(self) -> PKey: ...\r
73     def set_pubkey(self, pkey: PKey) -> None: ...\r
74     def sign(self, pkey: PKey, digest: str) -> None: ...\r
75     def get_signature_algorithm(self) -> str: ...\r
76     def digest(self, digest_name: str) -> str: ...\r
77     def subject_name_hash(self) -> str: ...\r
78     def set_serial_number(self, serial: int) -> None: ...\r
79     def get_serial_number(self) -> int: ...\r
80     def gmtime_adj_notAfter(self, amount: int) -> None: ...\r
81     def gmtime_adj_notBefore(self, amount: int) -> None: ...\r
82     def has_expired(self) -> bool: ...\r
83     def get_notBefore(self) -> str: ...\r
84     def set_notBefore(self, when: str) -> None: ...\r
85     def get_notAfter(self) -> str: ...\r
86     def set_notAfter(self, when: str) -> None: ...\r
87     def get_issuer(self) -> X509Name: ...\r
88     def set_issuer(self, issuer: X509Name) -> None: ...\r
89     def get_subject(self) -> X509Name: ...\r
90     def set_subject(self, subject: X509Name) -> None: ...\r
91     def get_extension_count(self) -> int: ...\r
92     def add_extensions(self, extensions: Iterable[X509Extension]) -> None: ...\r
93     def get_extension(self, index: int) -> X509Extension: ...\r
94 \r
95 class X509StoreFlags:\r
96     CRL_CHECK = ...  # type: int\r
97     CRL_CHECK_ALL = ...  # type: int\r
98     IGNORE_CRITICAL = ...  # type: int\r
99     X509_STRICT = ...  # type: int\r
100     ALLOW_PROXY_CERTS = ...  # type: int\r
101     POLICY_CHECK = ...  # type: int\r
102     EXPLICIT_POLICY = ...  # type: int\r
103     INHIBIT_MAP = ...  # type: int\r
104     NOTIFY_POLICY = ...  # type: int\r
105     CHECK_SS_SIGNATURE = ...  # type: int\r
106     CB_ISSUER_CHECK = ...  # type: int\r
107 \r
108 class X509Store:\r
109     def __init__(self) -> None: ...\r
110     def add_cert(self, cert: X509) -> None: ...\r
111     def add_crl(self, crl: CRL) -> None: ...\r
112     def set_flags(self, flags: int) -> None: ...\r
113 \r
114 class X509StoreContextError(Exception):\r
115     certificate = ...  # type: X509\r
116     def __init__(self, message: str, certificate: X509) -> None: ...\r
117 \r
118 class X509StoreContext:\r
119     def __init__(self, store: X509Store, certificate: X509) -> None: ...\r
120     def set_store(self, store: X509Store) -> None: ...\r
121     def verify_certificate(self) -> None: ...\r
122 \r
123 def load_certificate(type: int, buffer: Union[str, unicode]) -> X509: ...\r
124 def dump_certificate(type: int, cert: X509) -> bytes: ...\r
125 def dump_publickey(type: int, pkey: PKey) -> bytes: ...\r
126 def dump_privatekey(type: int, pkey: PKey, cipher: Optional[str] = ..., passphrase: Optional[Union[str, Callable[[int], int]]] = ...) -> bytes: ...\r
127 \r
128 class Revoked:\r
129     def __init__(self) -> None: ...\r
130     def set_serial(self, hex_str: str) -> None: ...\r
131     def get_serial(self) -> str: ...\r
132     def set_reason(self, reason: str) -> None: ...\r
133     def get_reason(self) -> str: ...\r
134     def all_reasons(self) -> List[str]: ...\r
135     def set_rev_date(self, when: str) -> None: ...\r
136     def get_rev_date(self) -> str: ...\r
137 \r
138 class CRL:\r
139     def __init__(self) -> None: ...\r
140     def get_revoked(self) -> Tuple[Revoked, ...]: ...\r
141     def add_revoked(self, revoked: Revoked) -> None: ...\r
142     def get_issuer(self) -> X509Name: ...\r
143     def set_version(self, version: int) -> None: ...\r
144     def set_lastUpdate(self, when: str) -> None: ...\r
145     def set_nextUpdate(self, when: str) -> None: ...\r
146     def sign(self, issuer_cert: X509, issuer_key: PKey, digest: str) -> None: ...\r
147     def export(self, cert: X509, key: PKey, type: int = ..., days: int = ..., digest: str = ...) -> bytes: ...\r
148 \r
149 class PKCS7:\r
150     def type_is_signed(self) -> bool: ...\r
151     def type_is_enveloped(self) -> bool: ...\r
152     def type_is_signedAndEnveloped(self) -> bool: ...\r
153     def type_is_data(self) -> bool: ...\r
154     def get_type_name(self) -> str: ...\r
155 \r
156 class PKCS12:\r
157     def __init__(self) -> None: ...\r
158     def get_certificate(self) -> X509: ...\r
159     def set_certificate(self, cert: X509) -> None: ...\r
160     def get_privatekey(self) -> PKey: ...\r
161     def set_privatekey(self, pkey: PKey) -> None: ...\r
162     def get_ca_certificates(self) -> Tuple[X509, ...]: ...\r
163     def set_ca_certificates(self, cacerts: Iterable[X509]) -> None: ...\r
164     def set_friendlyname(self, name: bytes) -> None: ...\r
165     def get_friendlyname(self) -> bytes: ...\r
166     def export(self, passphrase: Optional[str] = ..., iter: int = ..., maciter: int = ...): ...\r
167 \r
168 class NetscapeSPKI:\r
169     def __init__(self) -> None: ...\r
170     def sign(self, pkey: PKey, digest: str) -> None: ...\r
171     def verify(self, key: PKey) -> bool: ...\r
172     def b64_encode(self) -> str: ...\r
173     def get_pubkey(self) -> PKey: ...\r
174     def set_pubkey(self, pkey: PKey) -> None: ...\r
175 \r
176 def load_publickey(type: int, buffer: Union[str, unicode]) -> PKey: ...\r
177 def load_privatekey(type: int, buffer: bytes, passphrase: Optional[Union[str, Callable[[int], int]]] = ...): ...\r
178 def dump_certificate_request(type: int, req: X509Req): ...\r
179 def load_certificate_request(type, buffer: Union[str, unicode]) -> X509Req: ...\r
180 def sign(pkey: PKey, data: Union[str, unicode], digest: str) -> bytes: ...\r
181 def verify(cert: X509, signature: bytes, data: Union[str, unicode], digest: str) -> None: ...\r
182 def dump_crl(type: int, crl: CRL) -> bytes: ...\r
183 def load_crl(type: int, buffer: Union[str, unicode]) -> CRL: ...\r
184 def load_pkcs7_data(type: int, buffer: Union[str, unicode]) -> PKCS7: ...\r
185 def load_pkcs12(buffer: Union[str, unicode], passphrase: Optional[Union[str, Callable[[int], int]]] = ...) -> PKCS12: ...\r