Let us say that I use the algorithm on this site to encrypt and decrypt data with public-private keys:
Public Key RSA Encryption in C# .NET on CodeProject
Now, let us say that someone encrypts his data using my public key using another algorithm and sends it to me. Using a different algorithm (like the one on the site), will I be able to decrypt the information back using my private key? Or is this impossible since the algorithms were different?
My point is, will the end result always be the same if different encryption algorithms are used, assuming that the keys used are correct?
Is there some standard way to encrypt information to make it decryptable across different machines, maybe different programming languages?
A bit of discussion going, but here is my humble attempt to answer the questions:
Using a different algorithm (like the one on the site), will I be able to decrypt the information back using my private key? Or is this impossible since the algorithms were different?
You most certainly will not be able to decrypt the data. Generally, you need a full match for the algorithm and keys. What can be different however are: platforms, OSs, hardware, languages or programs used to encrypt/decrypt. This is because an algorithm acts as a public contract with well-defined spec and implementation can be different as long as all the public API render the same result.
My point is, will the end result always be the same if different encryption algorithms are used, assuming that the keys used are correct?
Nearly every time these will be different results (saying nearly, I am just unaware of any such algorithms). You need to have full match for algorithm and required keys.
Is there some standard way to encrypt information to make it decryptable across different machines, maybe different programming languages?
Yes RSA, for example, keep your private key safe and share your public key. This is what HTTPS does first. Everyone with a public key can decrypt data encrypted with private key.
Or, you can use AES, a symmetric algorithm with a single key to encrypt/decrypt. This is what HTTPS does second. Given you share the key only between trusted parties, both can encrypt and decrypt (but no one else can, given they have no key).
来源:https://stackoverflow.com/questions/16261342/asymmetric-encryption-and-decryption