Skip to Content
Mastering Blockchain - Second Edition
book

Mastering Blockchain - Second Edition

by Ankur Daharwal, Imran Bashir, Pranav Burnwal
March 2018
Beginner to intermediate
656 pages
20h 9m
English
Packt Publishing
Content preview from Mastering Blockchain - Second Edition

How to generate a digital signature using OpenSSL

The first step is to generate a hash of the message file:

$ openssl dgst -sha256 message.txt 
SHA256(message.txt)=
eb96d1f89812bf4967d9fb4ead128c3b787272b7be21dd2529278db1128d559c  

Both hash generation and signing can be done in a single step, as shown here. Note that privatekey.pem is generated in the steps provided previously:

$ openssl dgst -sha256 -sign privatekey.pem -out signature.bin message.txt  

Now, let's display the directory showing the relevant files:

$ ls -ltr total 36
-rw-rw-r-- 1 drequinox drequinox 14 Sep 21 05:54 message.txt
-rw-rw-r-- 1 drequinox drequinox 32 Sep 21 05:57 message.bin
-rw-rw-r-- 1 drequinox drequinox 45 Sep 21 06:00 message.b64
-rw-rw-r-- 1 drequinox drequinox ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Blockchain - Third Edition

Mastering Blockchain - Third Edition

Imran Bashir
Mastering Blockchain

Mastering Blockchain

Lorne Lantz, Daniel Cawrey
Mastering Ethereum

Mastering Ethereum

Andreas M. Antonopoulos, Gavin Wood

Publisher Resources

ISBN: 9781788839044Supplemental Content