Skip to content
New issue

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

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

Already on GitHub? # to your account

"Example" in api code makes cryptography a required dependency #76

Open
Dobatymo opened this issue Dec 10, 2024 · 0 comments
Open

"Example" in api code makes cryptography a required dependency #76

Dobatymo opened this issue Dec 10, 2024 · 0 comments

Comments

@Dobatymo
Copy link

See

# Example of using python crypto to sign data using openssl with Ps256
from cryptography.hazmat.primitives import hashes, serialization
from cryptography.hazmat.primitives.asymmetric import padding
def sign_ps256(data: bytes, key: bytes) -> bytes:
private_key = serialization.load_pem_private_key(
key,
password=None,
)
signature = private_key.sign(
data,
padding.PSS(
mgf=padding.MGF1(hashes.SHA256()),
salt_length=padding.PSS.MAX_LENGTH
),
hashes.SHA256()
)
return signature

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant