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

Summer time Airboat Rides in Orlando: Consolation Ideas

A summer time airboat experience in Orlando will be comfy if you select an appropriate departure time, put on light-weight clothes, apply sunscreen,...

What Is Habitat Loss and Why Does It Matter?

Each wild animal wants a spot the place it might discover meals, water, shelter, and sufficient house to breed. That place is its...

The Way forward for Bodily AI in Transportation and Freight

One of the crucial necessary issues to know about bodily AI is that it's going to not scale . The freight business has seen...

Recent articles

More like this

LEAVE A REPLY

Please enter your comment!
Please enter your name here