Is it possible to encrypt with private key using .net RSACryptoServiceProvider?

前端 未结 9 1974
醉话见心
醉话见心 2020-12-08 05:32

I know that RSACryptoServiceProvider can encrypt with the public key, then it can be decrypted with the private key.

Is it possible to encrypt with the private key a

相关标签:
9条回答
  • 2020-12-08 06:00

    Performing the raw RSA operation with the private key is usually called the decryption operation (just as performing it with the public key is called the encryption operation).

    It is useful to have access to this operation - for example to implement an operation that is not supported by the framework.

    The operation exists: it is the DecryptValue-method, which is defined by RSACryptoServiceProvider's base-class: System.Security.Cryptography.RSA. Unfortunately, it is not supported by RSACryptoServiceProvider (since the underlying win32-api, CryptoAPI, does not support it). If you could get hold of another .NET-implementation of the RSA-class, you would be able to do it, however.

    0 讨论(0)
  • 2020-12-08 06:00

    This is what I understand RSA signature.

    pseudo code:

    First Alice made a signature:

    alice_signature = encrypt(alice_message, alice_private_key)
    

    Then Bob Eve... (anyone who having alice_public_key) verify the signature:

    decrypted_message = decrypt(alice_signature, alice_public_key)
    

    To confirm:

    if(received_message_from_alice == decrypted_message)
      the signature proved the message is from alice
    
    0 讨论(0)
  • 2020-12-08 06:09

    The security of public key cryptosystems rests on the fact that the sign()/encrypt() function is a one-way function in that it would take an infeasible amount of time to decrypt it without the public key "trap-door".

    Also, usually the generated keys are not the same length, although they could be. There is a lot of papers about asymmetric key length with RSA.

    0 讨论(0)
提交回复
热议问题