Skip to main content
added 136 characters in body
Source Link
Matt Swezey
  • 1.3k
  • 6
  • 13
(A) => MSG => {ENCRYPT w/ B's Public Key} => {MSG} => (B) 
(B) => {MSG} => {UNENCRYPT w/ private key} => MSG

For (C) to be able to get this {MSG}, it cannot be encrypted with B's public key.

(B) would have to decrypt the {MSG}. Then, encrypt using (C)'s public key.

Now (C) can receive the message, decrypt, and read what it says.

This, I believe, you already understand.

But this process, of decrypting & encrypting, needs to happen off chain as it requires a private key and plain text to be sent via a transaction. You DO NOT do this!

To decrypt using a smart contract would require one to send out their private key to every miner on the blockchain! 😱 The same is true for encrypting, the plain text would be sent to every miner!

See this topic: Cryptography in a smart contract

So, encrypt and decrypt off chain. The payments can still be facilitated via smart contracts. Throw events to trigger the process to encrypt/decrypt off chain and send a new transaction to deliver the encrypted message to a new SC.

The SCs at this point would handle payments and already encrypted messages.

And as mentioned by SteveJaxon, to verify that (B) did not alter the message, you'd provide a hash of the original message that came from (A).

(A) => MSG => {ENCRYPT w/ B's Public Key} => {MSG} => (B) 
(B) => {MSG} => {UNENCRYPT w/ private key} => MSG

For (C) to be able to get this {MSG}, it cannot be encrypted with B's public key.

(B) would have to decrypt the {MSG}. Then, encrypt using (C)'s public key.

Now (C) can receive the message, decrypt, and read what it says.

This, I believe, you already understand.

But this process, of decrypting & encrypting, needs to happen off chain as it requires a private key and plain text to be sent via a transaction. You DO NOT do this!

To decrypt using a smart contract would require one to send out their private key to every miner on the blockchain! 😱 The same is true for encrypting, the plain text would be sent to every miner!

See this topic: Cryptography in a smart contract

So, encrypt and decrypt off chain. The payments can still be facilitated via smart contracts. Throw events to trigger the process to encrypt/decrypt off chain and send a new transaction to deliver the encrypted message to a new SC.

The SCs at this point would handle payments and already encrypted messages.

(A) => MSG => {ENCRYPT w/ B's Public Key} => {MSG} => (B) 
(B) => {MSG} => {UNENCRYPT w/ private key} => MSG

For (C) to be able to get this {MSG}, it cannot be encrypted with B's public key.

(B) would have to decrypt the {MSG}. Then, encrypt using (C)'s public key.

Now (C) can receive the message, decrypt, and read what it says.

This, I believe, you already understand.

But this process, of decrypting & encrypting, needs to happen off chain as it requires a private key and plain text to be sent via a transaction. You DO NOT do this!

To decrypt using a smart contract would require one to send out their private key to every miner on the blockchain! 😱 The same is true for encrypting, the plain text would be sent to every miner!

See this topic: Cryptography in a smart contract

So, encrypt and decrypt off chain. The payments can still be facilitated via smart contracts. Throw events to trigger the process to encrypt/decrypt off chain and send a new transaction to deliver the encrypted message to a new SC.

The SCs at this point would handle payments and already encrypted messages.

And as mentioned by SteveJaxon, to verify that (B) did not alter the message, you'd provide a hash of the original message that came from (A).

Source Link
Matt Swezey
  • 1.3k
  • 6
  • 13

(A) => MSG => {ENCRYPT w/ B's Public Key} => {MSG} => (B) 
(B) => {MSG} => {UNENCRYPT w/ private key} => MSG

For (C) to be able to get this {MSG}, it cannot be encrypted with B's public key.

(B) would have to decrypt the {MSG}. Then, encrypt using (C)'s public key.

Now (C) can receive the message, decrypt, and read what it says.

This, I believe, you already understand.

But this process, of decrypting & encrypting, needs to happen off chain as it requires a private key and plain text to be sent via a transaction. You DO NOT do this!

To decrypt using a smart contract would require one to send out their private key to every miner on the blockchain! 😱 The same is true for encrypting, the plain text would be sent to every miner!

See this topic: Cryptography in a smart contract

So, encrypt and decrypt off chain. The payments can still be facilitated via smart contracts. Throw events to trigger the process to encrypt/decrypt off chain and send a new transaction to deliver the encrypted message to a new SC.

The SCs at this point would handle payments and already encrypted messages.