is there a way using public key cryptography (asymmetric cryptography) in a smart contract. The idea is to:
1) Encrypt some text and publish it on the block chain as a transaction.
function encryptData(string pubKey, string text){
...
}
2) And later, have a call (local invocation of a contract function) to decrypt it:
function decryptData(string privKey, string text){
...
}
I've found some related topics about signatures using ecrecover , but not about cryptography.
Best Answer
Note that no matter if you are using an internal or external call, in order to decrypt something on-chain, you have to give the miners the private key, which is obviously not so private anymore. That is the reason why encryption is hardly implementable in open blockchains like Ethereum.