Skip to content

Commit

Permalink
Update to Python3.10 as default in pipfile
Browse files Browse the repository at this point in the history
Bump cryptography to v42
Fixed incompatibility

Needs more testing before release
  • Loading branch information
Lars Scheibling committed Jan 23, 2024
1 parent 1ea19eb commit 557d0cb
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 65 deletions.
4 changes: 2 additions & 2 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name = "pypi"

[packages]
click = "~=8.1"
cryptography = "~=41.0"
cryptography = "~=42.0"
bcrypt = "~=4.1"
prettytable = "~=3.1"
pytimeparse2 = "~=1.4"
Expand All @@ -21,4 +21,4 @@ cprint = "*"
pylint = "*"

[requires]
python_version = "3.9"
python_version = "3.10"
122 changes: 70 additions & 52 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
click~=8.1
cryptography~=41.0.0
cryptography~=42.0.0
bcrypt~=4.1
PrettyTable~=3.9
pytimeparse2~=1.1
15 changes: 5 additions & 10 deletions src/sshkey_tools/keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,8 @@
from typing import Union

from cryptography.exceptions import InvalidSignature
from cryptography.hazmat.backends.openssl.ec import (
_EllipticCurvePrivateKey,
_EllipticCurvePublicKey,
)
from cryptography.hazmat.bindings import _rust as _RustBinding

from cryptography.hazmat.backends.openssl.rsa import _RSAPrivateKey, _RSAPublicKey
from cryptography.hazmat.primitives import hashes as _HASHES
from cryptography.hazmat.primitives import serialization as _SERIALIZATION
from cryptography.hazmat.primitives.asymmetric import dsa as _DSA
Expand All @@ -29,14 +24,14 @@
from .utils import sha512_fingerprint as _FP_SHA512

PUBKEY_MAP = {
_RSAPublicKey: "RsaPublicKey",
_EllipticCurvePublicKey: "EcdsaPublicKey",
_RustBinding.openssl.rsa.RSAPublicKey: "RsaPublicKey",
_RustBinding.openssl.ec.ECPublicKey: "EcdsaPublicKey",
_RustBinding.openssl.ed25519.Ed25519PublicKey: "Ed25519PublicKey",
}

PRIVKEY_MAP = {
_RSAPrivateKey: "RsaPrivateKey",
_EllipticCurvePrivateKey: "EcdsaPrivateKey",
_RustBinding.openssl.rsa.RSAPrivateKey: "RsaPrivateKey",
_RustBinding.openssl.ec.ECPrivateKey: "EcdsaPrivateKey",
# trunk-ignore(gitleaks/generic-api-key)
_RustBinding.openssl.ed25519.Ed25519PrivateKey: "Ed25519PrivateKey",
}
Expand Down Expand Up @@ -780,7 +775,7 @@ def generate(cls, curve: EcdsaCurves = EcdsaCurves.P521):
Returns:
EcdsaPrivateKey: An instance of EcdsaPrivateKey
"""
return cls.from_class(_ECDSA.generate_private_key(curve=curve.value))
return cls.from_class(_ECDSA.generate_private_key(curve=curve.value()))

def sign(self, data: bytes):
"""
Expand Down

0 comments on commit 557d0cb

Please sign in to comment.