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

Torc Helps GO Virginia–Funded Effort to Align Autonomous Car Workforce Coaching Throughout the Commonwealth

BLACKSBURG, Va – March 10, 2026 – Torc, a pioneer in commercializing self-driving class 8 vans, as we speak introduced its participation in...

Union tries to grab management of works council at Tesla’s German manufacturing unit | Tesla

Europe’s largest commerce union is attempting to realize management of the works council at Elon Musk’s Tesla gigafactory close to Berlin, in an...

Nvidia and UK Wealth Fund to put money into British autonomous driving startup Oxa | Nvidia

Nvidia is investing in the British autonomous driving startup Oxa, alongside backing from the UK’s Nationwide Wealth Fund, in a lift to the...

Recent articles

More like this

LEAVE A REPLY

Please enter your comment!
Please enter your name here