Skip to content

Commit 8a48f86

Browse files
committed
Remove python2 compatibility
- pyOpenSSL dropped python2 compatibility with 22.0.0 - Replace Text alias with str - Don’t inherit from object
1 parent becd974 commit 8a48f86

File tree

3 files changed

+34
-35
lines changed

3 files changed

+34
-35
lines changed

stubs/pyOpenSSL/METADATA.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
version = "21.0.*"
2-
python2 = true
1+
version = "22.0.*"
32
requires = ["types-cryptography"]

stubs/pyOpenSSL/OpenSSL/SSL.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ class SysCallError(Error): ...
111111

112112
def SSLeay_version(type: int) -> str: ...
113113

114-
class Session(object): ...
114+
class Session: ...
115115

116-
class Connection(object):
116+
class Connection:
117117
def __getattr__(self, name: str) -> Any: ... # incomplete
118118
def __init__(self, context: Context, socket: socket.socket | None = ...) -> None: ...
119119
def connect(self, addr: str | bytes | Sequence[str | int]) -> None: ...
@@ -134,7 +134,7 @@ class Connection(object):
134134
def get_app_data(self) -> Any: ...
135135
def set_app_data(self, data: Any) -> None: ...
136136

137-
class Context(object):
137+
class Context:
138138
def __getattr__(self, name: str) -> Any: ... # incomplete
139139
def __init__(self, method: int) -> None: ...
140140
def load_verify_locations(self, cafile: str | None, capath: str | None = ...) -> None: ...

stubs/pyOpenSSL/OpenSSL/crypto.pyi

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from datetime import datetime
2-
from typing import Any, Callable, Iterable, Sequence, Text, Union
2+
from typing import Any, Callable, Iterable, Sequence, Union
33

44
from cryptography.hazmat.primitives.asymmetric.dsa import DSAPrivateKey, DSAPublicKey
55
from cryptography.hazmat.primitives.asymmetric.rsa import RSAPrivateKey, RSAPublicKey
@@ -30,19 +30,19 @@ class PKey:
3030
def type(self) -> int: ...
3131

3232
class X509Name:
33-
countryName: Text
34-
C: Text
35-
stateOrProvinceName: Text
36-
ST: Text
37-
localityName: Text
38-
L: Text
39-
organizationName: Text
40-
O: Text
41-
organizationalUnitName: Text
42-
OU: Text
43-
commonName: Text
44-
CN: Text
45-
emailAddress: Text
33+
countryName: str
34+
C: str
35+
stateOrProvinceName: str
36+
ST: str
37+
localityName: str
38+
L: str
39+
organizationName: str
40+
O: str
41+
organizationalUnitName: str
42+
OU: str
43+
commonName: str
44+
CN: str
45+
emailAddress: str
4646
def __init__(self, name: X509Name) -> None: ...
4747
def der(self) -> bytes: ...
4848
def get_components(self) -> list[tuple[bytes, bytes]]: ...
@@ -51,7 +51,7 @@ class X509Name:
5151
class X509:
5252
def __init__(self) -> None: ...
5353
def add_extensions(self, extensions: Iterable[X509Extension]) -> None: ...
54-
def digest(self, digest_name: Text) -> bytes: ...
54+
def digest(self, digest_name: str) -> bytes: ...
5555
@classmethod
5656
def from_cryptography(cls, crypto_cert: Certificate) -> X509: ...
5757
def get_extension(self, index: int) -> X509Extension: ...
@@ -74,7 +74,7 @@ class X509:
7474
def set_serial_number(self, serial: int) -> None: ...
7575
def set_subject(self, subject: X509Name) -> None: ...
7676
def set_version(self, version: int) -> None: ...
77-
def sign(self, pkey: PKey, digest: Text) -> None: ...
77+
def sign(self, pkey: PKey, digest: str) -> None: ...
7878
def subject_name_hash(self) -> bytes: ...
7979
def to_cryptography(self) -> Certificate: ...
8080

@@ -89,7 +89,7 @@ class X509Req:
8989
def get_version(self) -> int: ...
9090
def set_pubkey(self, pkey: PKey) -> None: ...
9191
def set_version(self, version: int) -> None: ...
92-
def sign(self, pkey: PKey, digest: Text) -> None: ...
92+
def sign(self, pkey: PKey, digest: str) -> None: ...
9393
def to_cryptography(self) -> CertificateSigningRequest: ...
9494
def verify(self, pkey: PKey) -> bool: ...
9595

@@ -129,7 +129,7 @@ class X509Store:
129129
def __init__(self) -> None: ...
130130
def add_cert(self, cert: X509) -> None: ...
131131
def add_crl(self, crl: CRL) -> None: ...
132-
def load_locations(self, cafile: Text | bytes, capath: Text | bytes | None = ...) -> None: ...
132+
def load_locations(self, cafile: str | bytes, capath: str | bytes | None = ...) -> None: ...
133133
def set_flags(self, flags: int) -> None: ...
134134
def set_time(self, vfy_time: datetime) -> None: ...
135135

@@ -141,7 +141,7 @@ class X509StoreContext:
141141

142142
class X509StoreContextError(Exception):
143143
certificate: X509
144-
def __init__(self, message: Text | bytes, certificate: X509) -> None: ...
144+
def __init__(self, message: str | bytes, certificate: X509) -> None: ...
145145

146146
class X509StoreFlags:
147147
CRL_CHECK: int
@@ -157,7 +157,7 @@ class X509StoreFlags:
157157
CB_ISSUER_CHECK: int
158158

159159
class PKCS7:
160-
def get_type_name(self) -> Text: ...
160+
def get_type_name(self) -> str: ...
161161
def type_is_data(self) -> bool: ...
162162
def type_is_enveloped(self) -> bool: ...
163163
def type_is_signed(self) -> bool: ...
@@ -180,24 +180,24 @@ class NetscapeSPKI:
180180
def b64_encode(self) -> bytes: ...
181181
def get_pubkey(self) -> PKey: ...
182182
def set_pubkey(self, pkey: PKey) -> None: ...
183-
def sign(self, pkey: PKey, digest: Text) -> None: ...
183+
def sign(self, pkey: PKey, digest: str) -> None: ...
184184
def verify(self, key: PKey) -> bool: ...
185185

186186
def get_elliptic_curves() -> set[_EllipticCurve]: ...
187-
def get_elliptic_curve(name: Text) -> _EllipticCurve: ...
187+
def get_elliptic_curve(name: str) -> _EllipticCurve: ...
188188
def dump_certificate(type: int, cert: X509) -> bytes: ...
189189
def load_certificate(type: int, buffer: bytes) -> X509: ...
190190
def dump_certificate_request(type: int, req: X509Req) -> bytes: ...
191191
def load_certificate_request(type: int, buffer: bytes) -> X509Req: ...
192192
def dump_privatekey(
193-
type: int, pkey: PKey, cipher: Text | None = ..., passphrase: bytes | Callable[[], bytes] | None = ...
193+
type: int, pkey: PKey, cipher: str | None = ..., passphrase: bytes | Callable[[], bytes] | None = ...
194194
) -> bytes: ...
195-
def load_privatekey(type: int, buffer: Text | bytes, passphrase: bytes | Callable[[], bytes] | None = ...) -> PKey: ...
195+
def load_privatekey(type: int, buffer: str | bytes, passphrase: bytes | Callable[[], bytes] | None = ...) -> PKey: ...
196196
def dump_publickey(type: int, pkey: PKey) -> bytes: ...
197-
def load_publickey(type: int, buffer: Text | bytes) -> PKey: ...
197+
def load_publickey(type: int, buffer: str | bytes) -> PKey: ...
198198
def dump_crl(type: int, crl: CRL) -> bytes: ...
199-
def load_crl(type: int, buffer: Text | bytes) -> CRL: ...
200-
def load_pkcs7_data(type: int, buffer: Text | bytes) -> PKCS7: ...
201-
def load_pkcs12(buffer: Text | bytes, passphrase: bytes | None = ...) -> PKCS12: ...
202-
def sign(pkey: PKey, data: Text | bytes, digest: Text) -> bytes: ...
203-
def verify(cert: X509, signature: bytes, data: Text | bytes, digest: Text) -> None: ...
199+
def load_crl(type: int, buffer: str | bytes) -> CRL: ...
200+
def load_pkcs7_data(type: int, buffer: str | bytes) -> PKCS7: ...
201+
def load_pkcs12(buffer: str | bytes, passphrase: bytes | None = ...) -> PKCS12: ...
202+
def sign(pkey: PKey, data: str | bytes, digest: str) -> bytes: ...
203+
def verify(cert: X509, signature: bytes, data: str | bytes, digest: str) -> None: ...

0 commit comments

Comments
 (0)