Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Two problems here:</p> <p>A) Your protocol design is wrong. If you want to use RSA to exchange messages, the algorithm is this:</p> <p>A encrypts message using B's <strong>public</strong> key</p> <p>A sends the message</p> <p>B decrypts the message using B's <strong>private</strong> key</p> <p>(B does processing)</p> <p>B encrypts message using A's <strong>public</strong> key</p> <p>B sends the message</p> <p>A decrypts the message using A's <strong>private</strong> key</p> <p>and so on. Notice how A does not know B's private key, and vice versa. The public and private keys are related in such a way that a message encrypted with a public key (known to everyone) can only be decrypted with the corresponding private key (known only to the intendent recipient of the encrypted message). This is the whole point of RSA, actually.</p> <p>As for implementation in C#, it is quite trivial to do with the Crypto classes once you really understand the underlying concepts. See for example <a href="http://msdn.microsoft.com/en-us/library/system.security.cryptography.rsacryptoserviceprovider.aspx" rel="nofollow">here</a> and <a href="http://www.codeproject.com/Articles/10877/Public-Key-RSA-Encryption-in-C-NET" rel="nofollow">here</a>.</p> <p>B) RSA is good for exchanging small amounts of data. It is meant for key exchange over an insecure channel without the need for a shared secret. For exchanging "normal" data, a symmetric algorithm such as AES is used. So the idea would be generating a random passphrase and IV from A, and sending that to B via RSA as discussed in A; after both parties know the passphrase and IV, they can just encrypt data using AES with the shared key. </p> <p>This is what SSL does, and you should have a really good reason to roll your own instead of using a standard SSL stream.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload