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

Encryption

Taking the private key generated in the previous example, the command to encrypt a text file message.txt can be constructed as shown here:

$ echo datatoencrypt > message.txt
   
$ openssl rsautl -encrypt -inkey publickey.pem -pubin -in message.txt \  -out message.rsa  

This will produce a file named message.rsa, which is in a binary format. If you open message.rsa in the nano editor or any other text editor of your choice, it will show some garbage as shown in the following screenshot:

message.rsa showing garbage (encrypted) data
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