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

Nvidia CEO reveals new ‘reasoning’ AI tech for self-driving vehicles | Nvidia

The billionaire boss of the chipmaker Nvidia, Jensen Huang, has unveiled new AI know-how that he says will assist self-driving vehicles assume like...

Tesla publishes analyst forecasts suggesting gross sales set to fall | Tesla

Tesla has taken the weird step of publishing gross sales forecasts that recommend 2025 deliveries might be decrease than anticipated and future years’...

5 tech tendencies we’ll be watching in 2026 | Expertise

Hi there, and welcome to TechScape. I’m your host, Blake Montgomery, wishing you a cheerful New Yr’s Eve full of cheer, champagne and...

Recent articles

More like this

LEAVE A REPLY

Please enter your comment!
Please enter your name here