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 Robotics Acknowledged as a 2024 Public Relations and Advertising Excellence Awards Winner

Driving Consciousness for Autonomous Trucking and Business Management “We’re extremely proud to obtain this award, which acknowledges our PR crew’s relentless dedication to advancing...

Daimler Truck subsidiary Torc Robotics achieves Driver-Out Validation Milestone

Autonomous driving firm, Torc Robotics, backed by Daimler Truck achieves driver-out functionality on closed course in Texas as it really works towards a...

Torc Robotics Performs Profitable Totally Autonomous Product Validation

BLACKSBURG, Va – Oct. 29, 2024 – Torc Robotics, an unbiased subsidiary of Daimler Truck AG and a pioneer in commercializing self-driving automobile know-how, right...

Recent articles

More like this

LEAVE A REPLY

Please enter your comment!
Please enter your name here