PSU Signer
Project description
PSU Signer
Quick development for applying PSU digital signature using (Endensive)[https://github.com/m32/endesive].
Documents
https://documenter.getpostman.com/view/644041/2s93eU1tyD
Installation
pip install psusigner
Example
import datetime
from psusigner import PSUSigner
def main():
fname = "file.pdf"
date = datetime.datetime.utcnow()
date = date.strftime("D:%Y%m%d%H%M%S+00'00'")
dct = {
"sigflags": 3,
"contact": "user@psu.ac.th",
"location": "Hat Yai, Thailand",
"signingdate": date.encode(),
"reason": "Test",
"attrs": False,
}
print("Secret Sign")
signer = PSUSigner(
code="c1",
secret="",
agent_key="",
api_url="https://ds-dev.psu.ac.th/api/v1", # change it to use production url or remove it for using default api url
)
outname = fname.replace(".pdf", "-signed-cms-psuhsm.pdf")
signer.sign_file(fname, dct, outname)
print("JWT Sign")
signer = PSUSigner(
code="c1",
secret="",
agent_key="",
jwt_secret="",
api_url="https://ds-dev.psu.ac.th/api/v1", # change it to use production url or remove it for using default api url
)
outname = fname.replace(".pdf", "-signed-cms-psuhsm-jwt.pdf")
signer.sign_file(fname, dct, outname)
search_response = signer.search(certEntryCode="c1")
print("search output:", search_response)
main()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
psusigner-0.1.9.tar.gz
(5.5 kB
view hashes)
Built Distribution
Close
Hashes for psusigner-0.1.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e17c06807a26167b6a4a13756ca9a2556e95cd89b84330dbad3f7201e043ccdf |
|
MD5 | b08ac71d1f84cbb712ee944ae8244aef |
|
BLAKE2b-256 | 2e4a722442cc64b01ed1346248f292f93cb198a8941c6d5fbce5d786ea86d08e |