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

Phrases we should always workers the barricades in opposition to | Gender

As somebody working in human assets who has spent years encouraging colleagues to make use of the phrase “staffing” quite than “manning”, I...

Torc Robotics Joins Auto-ISAC to Strengthen Cybersecurity Collaboration Throughout Linked Industrial Automobiles

BLACKSBURG, Va – August 3, 2026 – Torc Robotics, a pioneer in self-driving car expertise, at present introduced it has joined the Automotive...

‘Leicester Sq., please guv’: Self-driving taxis cleared for London streets ‘later this summer season’ | Self-driving automobiles

The taxi app firm Uber and the autonomous know-how developer Wayve have been granted the primary minicab licences in London permitting them to...

Recent articles

More like this

LEAVE A REPLY

Please enter your comment!
Please enter your name here