-
Notifications
You must be signed in to change notification settings - Fork 8
/
signature_c.py
61 lines (53 loc) · 2.68 KB
/
signature_c.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import ctypes
import os
ctypes.CDLL("libpbc.so.1")
pbc = ctypes.CDLL(os.getcwd() + "/crypto.so")
# Signature des fonctions C
"""This function is used to sign a challenge from a trusted third party
# @param chal_buffer the received challenge
# @param y_buffer the secret of the trusted third party
# @param cert_buffer the public certificate of the trusted third party
# @param gpk_buffer the public certificate of the certifcate authority
# @param g1_buffer the g1 of the certifcate authority
# @param g2_buffer the g2 of the certifcate authority
# @param signed_chal_buffer the resulting challenge signed
# @other params parameters of the signature
"""
pbc.trusted_sign_challenge.argtypes = [ctypes.c_char_p] * 29
"""This function is used to verify a challenge generated by trusted third party for a given website
# @param chal_buffer the original challenge
# @param gpk_buffer the public certificate of the certifcate authority
# @param y_buffer the secret of the trusted third party
# @param cert_buffer the public certificate of the trusted third party
# @param g1_buffer the g1 of the certifcate authority
# @param g2_buffer the g2 of the certifcate authority
# @param sig_buffer the signed challenge
# @other params parameters of the signature
"""
pbc.site_verify_sign.argtypes = [ctypes.c_char_p] * 27
"""This function is used to verify that the trusted third party has not been revocated
# @param chal_buffer the original challenge
# @param g2_buffer the g2 of the certifcate authority
# @param tk_buffer the revocation keys for the given trusted third party
# @param sig_buffer the signed challenge
"""
pbc.site_verify_tk.argtypes = [ctypes.c_char_p] * 4
"""This function is used to generate a certificate and a secret key for a new trusted third party by the authority
# @param gpk_buffer the public certificate of the authority
# @param gsk_buffer the private key of the authority
# @param g1_buffer the g1 of the authority
# @param g2_buffer the g2 of the authority
# @param y_buffer the secret of the trusted third party
# @param cert_buffer the public certificate of the trusted third party
# @param tk_buffer the revocation keys for the given trusted third party
"""
pbc.new_certificate.argtypes = [ctypes.c_char_p] * 7
"""This function to initiate the authority with a certificate and a private key
# @param gpk_buffer the public certificate of the authority
# @param gsk_buffer the private key of the authority
# @param h1_buffer the public h1 of the authority
# @param alpha_buffer the private alpha of the authory
# @param g1_buffer the g1 of the authority
# @param g2_buffer the g2 of the authority
"""
pbc.authority_init.argtypes = [ctypes.c_char_p] * 5