forked from mikeboers/PyTomCrypt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrsa-core.pxd
More file actions
80 lines (65 loc) · 2.27 KB
/
Copy pathrsa-core.pxd
File metadata and controls
80 lines (65 loc) · 2.27 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
cdef extern from "tomcrypt.h" nogil:
cdef int c_RSA_TYPE_PUBLIC "PK_PUBLIC"
cdef int c_RSA_TYPE_PRIVATE "PK_PRIVATE"
ctypedef struct rsa_key:
int type # One of PK_PUBLIC or PK_PRIVATE
# The public exponent
void *e
# The private exponent
void *d
# The modulus
void *N
# The p factor of N
void *p
# The q factor of N
void *q
# The 1/q mod p CRT param
void *qP
# The d mod (p - 1) CRT param
void *dP
# The d mod (q - 1) CRT param
void *dQ
int rsa_make_key(prng_state *state, int prng_idx, int size, long e, rsa_key *key)
void rsa_free(rsa_key *key)
int rsa_import(unsigned char *input, unsigned long inlen, rsa_key *key)
int rsa_export(unsigned char *out, unsigned long *outlen, int type, rsa_key *key)
cdef int c_RSA_PAD_V1_5 "LTC_PKCS_1_V1_5"
cdef int c_RSA_PAD_OAEP "LTC_PKCS_1_OAEP"
cdef int c_RSA_PAD_PSS "LTC_PKCS_1_PSS"
int rsa_exptmod(
unsigned char *input, unsigned long inlen,
unsigned char *out , unsigned long *outlen,
int mode,
rsa_key *key)
int rsa_encrypt_key_ex(
unsigned char *input, unsigned long inlen,
unsigned char *out, unsigned long *outlen,
unsigned char *lparam, unsigned long lparamlen,
prng_state *prng, int prng_idx,
int hash_idx,
int padding,
rsa_key *key)
int rsa_decrypt_key_ex(
unsigned char *input, unsigned long inlen,
unsigned char *out, unsigned long *outlen,
unsigned char *lparam, unsigned long lparamlen,
int hash_idx,
int padding,
int *success,
rsa_key *key)
int rsa_sign_hash_ex(
unsigned char *input, unsigned long inlen,
unsigned char *out, unsigned long *outlen,
int padding,
prng_state *prng, int prng_idx,
int hash_idx,
unsigned long saltlen,
rsa_key *key)
int rsa_verify_hash_ex(
unsigned char *sig, unsigned long siglen,
unsigned char *hash, unsigned long hashlen,
int padding,
int hash_idx,
unsigned long saltlen,
int *success,
rsa_key *key)