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

I used to be cautious of driverless automobiles and their tech overlords – however they might give me a special future | Gabriel Stewart

The robotaxis are coming! The robotaxis are coming! Properly, truly, they’re already right here. Till now they’ve been the stuff of science fiction,...

From Automation to Bodily AI: The Technical Vacation spot Freight Has Been Constructing Towards

For many years, the trucking trade has chased the identical objective—transfer extra freight, extra reliably, at decrease price, safely—driving successive waves of funding...

Torc’s Mission Intersects With Occasion Traits of Bodily, Multi-Modal AI, Deployable Methods

Advancing the Way forward for Autonomous Driving CVPR 2026 marked its largest version so far, bringing collectively greater than 10,000 attendees and setting a...

Recent articles

More like this

LEAVE A REPLY

Please enter your comment!
Please enter your name here