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 Named First Business Accomplice for Edge Case’s Guardian

Edge Case has launched Guardian, an AI-powered security intelligence platform designed to provide organizations a steady, system-level understanding of threat throughout autonomous and...

London’s first self-driving taxis for rent hit the streets | Self-driving automobiles

Londoners are actually capable of rent self-driving taxis for the primary time, after rides in Wayve’s autonomous automobiles had been added to the...

Strengthening Autonomous Truck Security Via First Responder Collaboration

The occasion additionally delivered vital technical worth. Excessive-quality emergency car and responder interplay information is vital for enhancing notion programs. Each state of affairs...

Recent articles

More like this

LEAVE A REPLY

Please enter your comment!
Please enter your name here