Skip to content

Commit

Permalink
Run pki cert example
Browse files Browse the repository at this point in the history
  • Loading branch information
michal-sa committed Mar 28, 2024
1 parent fe56b5a commit 6061dac
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions hello_world/app.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
import json

from pki_tools import Name, Certificate, LoadError
import datetime

from pki_tools import Name, Certificate, Validity, RSAKeyPair, SHA512


def lambda_handler(event, context):
print(pki_tools.__version__)
name = Name(cn=["Cert CN"])

validity = Validity(
not_before=datetime.datetime.today() - datetime.timedelta(days=1),
not_after=datetime.datetime.today() + datetime.timedelta(days=1),
)

cert = Certificate(
subject=name,
issuer=name,
validity=validity,
)

cert.sign(RSAKeyPair.generate(), SHA512)

print(cert)


# try:
# ip = requests.get("http://checkip.amazonaws.com/")
Expand Down

0 comments on commit 6061dac

Please sign in to comment.