| Electronic Components Datasheet Search |
|
DEV-15573 Datasheet(PDF) 25 Page - SparkFun Electronics |
|
|
|||||||||||||||||||||||||||||
DEV-15573 Datasheet(HTML) 25 Page - SparkFun Electronics |
|
25 / 31 page ![]() //Let's create a digital signature! atecc.createSignature(message); // by default, this uses the private key securely stored and loc ked in slot 0. // Now let's send the message to Bob. // this will include three things: // (1) start header ("$$") ASCII "$" = 0x24 HEX // (2) message (32 bytes) // (3) signature (64 bytes) // start header Serial1.print("$"); // message // note, we use "Serial.write" because we are sending bytes of data (not characters) for (int i = 0; i < sizeof(message) ; i++) Serial1.write(message[i]); // signature // Note, in Example4_Alice we are printing the signature we JUST created, // and it lives inside the library as a public array called "atecc.signature" for (int i = 0; i < sizeof(atecc.signature) ; i++) Serial1.write(atecc.signature[i]); At the top of this code block, you can see she is using atecc.createSignature(message) , just like in Example2_sign . Then Alice sends everything to Bob, including a start "header" ( $$$ ). This is simply used to avoid errors during transmission and helps ensure that Bob hears the entire message. One important thing to note is that when Alice sends her message and signature to Bob, she uses the Serial1.write() function, because she is sending data (not ASCII characters). Now let's take a closer look at the important stuff in Example4_Bob.ino. Bob's sketch is actually quite similar to Example3_Verify.ino , although he receives the message and signature on his RX1 pin. // Delete this "blank" public key, // copy/paste Alice's true unique public key from her terminal printout in Example4_Alice. uint8_t AlicesPublicKey[64] = { 0xB4, 0x07, 0x88, 0x28, 0x8C, 0xFA, 0x71, 0xBA, 0x08, 0xE3, 0x38, 0xE0, 0x4A, 0x17, 0x68, 0xCC, 0x3E, 0xCD, 0x48, 0xA8, 0x11, 0x52, 0xDD, 0x37, 0xA1, 0xC2, 0x55, 0x75, 0x81, 0xBE, 0x4E, 0x7E, 0x78, 0x98, 0x95, 0xF6, 0x6D, 0xE7, 0x1C, 0x9A, 0x36, 0xE6, 0xB0, 0x14, 0x5D, 0x50, 0x67, 0x91, 0x7C, 0x41, 0xB8, 0x99, 0x20, 0x75, 0x3A, 0x7D, 0xA1, 0xFB, 0xF5, 0x5E, 0x8A, 0x65, 0xF5, 0x8A }; At the top, you need to copy in Alice's public key. Bob will need this to verify any messages and signatures he receives. Note, yours will be different than what I'm showing above. |
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |