cryptography – Tips on how to encrypt messages with Pub/Priv keys

on

|

views

and

comments


I am questioning if it is attainable to make use of the Bitcoin private and non-private keys (normally used for signing) for textual content encryption. That is an instance in nodeJs:

import pkg from 'bitcore-lib'

const { PrivateKey, Networks } = pkg
const privateKey = new PrivateKey(Networks['livenet'])
const myObject = {
    privateKey: privateKey,
    P2PKHAddress: privateKey.toAddress(),
    publicKey: privateKey.toPublicKey(),
    wif: privateKey.toWIF()
}

It’s attainable to make use of publicKey to encrypt a message and decrypt with privateKey?

const encryptedText = encrypt('Hiya', publicKey)
const decryptedText = decrypt(encryptedText, privateKey)

assert decryptedText === 'Hiya'

Share this
Tags

Must-read

Constructing the Torc Driverless Security Case

At Torc, we’ve structured our security case on three foundational pillars: Engineer It to Be Secure, Function It to Be Secure, and the...

What’s DL+S? Unlocking the Huge Information Required to Develop Autonomous Vans

Breakthroughs in AI for autonomous driving don't occur in isolation. They occur when information, simulation, machine studying, infrastructure, and car testing work as...

Why I can’t wait to get right into a driverless automotive | Self-driving automobiles

Adrian Chiles (Driverless automobiles are taking us on a street to nowhere, 10 September) needs to know who requested for driverless automobiles. I...

Recent articles

More like this

LEAVE A REPLY

Please enter your comment!
Please enter your name here