Skip to content

Use pyasn1 in python-jose #9469

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stubs/python-jose/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version = "3.3.*"
requires = [] # excluding pyasn1, pyrsa, cryptography until typing is available
requires = ["types-pyasn1"] # excluding pyrsa, cryptography until typing is available

[tool.stubtest]
ignore_missing_stub = false
27 changes: 11 additions & 16 deletions stubs/python-jose/jose/backends/_asn1.pyi
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
from typing import Any
from typing_extensions import TypeAlias

# Enable when pyasn1 gets stubs:
# from pyasn1.type import univ
_Sequence: TypeAlias = Any
from pyasn1.type import namedtype, univ

RSA_ENCRYPTION_ASN1_OID: str

class RsaAlgorithmIdentifier(_Sequence):
componentType: Any
class RsaAlgorithmIdentifier(univ.Sequence):
componentType: namedtype.NamedTypes

class PKCS8PrivateKey(_Sequence):
componentType: Any
class PKCS8PrivateKey(univ.Sequence):
componentType: namedtype.NamedTypes

class PublicKeyInfo(_Sequence):
componentType: Any
class PublicKeyInfo(univ.Sequence):
componentType: namedtype.NamedTypes

def rsa_private_key_pkcs8_to_pkcs1(pkcs8_key): ...
def rsa_private_key_pkcs1_to_pkcs8(pkcs1_key): ...
def rsa_public_key_pkcs1_to_pkcs8(pkcs1_key): ...
def rsa_public_key_pkcs8_to_pkcs1(pkcs8_key): ...
def rsa_private_key_pkcs8_to_pkcs1(pkcs8_key) -> bytes: ...
def rsa_private_key_pkcs1_to_pkcs8(pkcs1_key) -> bytes: ...
def rsa_public_key_pkcs1_to_pkcs8(pkcs1_key) -> bytes: ...
def rsa_public_key_pkcs8_to_pkcs1(pkcs8_key) -> bytes: ...
Comment on lines +14 to +17
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll trust that you're correct here; the source code is a maze 😆