File tree 2 files changed +49
-0
lines changed 2 files changed +49
-0
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,52 @@ int ECC508Class::random(byte data[], size_t length)
62
62
return 1 ;
63
63
}
64
64
65
+ int ECC508Class::generatePrivateKey (int slot, byte publicKey[])
66
+ {
67
+ if (!wakeup ()) {
68
+ return 0 ;
69
+ }
70
+
71
+ if (!sendCommand (0x40 , 0x04 , slot)) {
72
+ return 0 ;
73
+ }
74
+
75
+ delay (115 );
76
+
77
+ if (!receiveResponse (publicKey, 64 )) {
78
+ return 0 ;
79
+ }
80
+
81
+ delay (1 );
82
+
83
+ idle ();
84
+
85
+ return 1 ;
86
+ }
87
+
88
+ int ECC508Class::generatePublicKey (int slot, byte publicKey[])
89
+ {
90
+ if (!wakeup ()) {
91
+ return 0 ;
92
+ }
93
+
94
+ if (!sendCommand (0x40 , 0x00 , slot)) {
95
+ return 0 ;
96
+ }
97
+
98
+ delay (115 );
99
+
100
+ if (!receiveResponse (publicKey, 64 )) {
101
+ return 0 ;
102
+ }
103
+
104
+ delay (1 );
105
+
106
+ idle ();
107
+
108
+ return 1 ;
109
+ }
110
+
65
111
int ECC508Class::ecdsaVerify (const byte message[], const byte signature[], const byte pubkey[])
66
112
{
67
113
if (!challenge (message)) {
Original file line number Diff line number Diff line change @@ -15,6 +15,9 @@ class ECC508Class
15
15
16
16
int random (byte data[], size_t length);
17
17
18
+ int generatePrivateKey (int slot, byte publicKey[]);
19
+ int generatePublicKey (int slot, byte publicKey[]);
20
+
18
21
int ecdsaVerify (const byte message[], const byte signature[], const byte pubkey[]);
19
22
int ecSign (int slot, const byte message[], byte signature[]);
20
23
You can’t perform that action at this time.
0 commit comments