How? Encrypt using private key


G

Guest

I want to encrypt some data with a private key. How?

As far as I know, public/private key cryptology is supposed to allow for
data to be encrypted by either key and decrypted with the other key.

Given this, why is it that everyingthing in .NET (as far as I can see) only
allows for encrypting data using a public key? Surely there are situations
where encrypting data with a private key is useful. I fully understand public
key encryption's usefullness for passing a symetric key, but here's my
situation.

I have clients running an app. I want to send them some data. I do not care
who reads this data. I only care about 2 things.

1) No one but me could have written that data.
2) The data can not be altered without being corrupted.

Encrypting said data using my private key seems it would do just that. But
how do I use .NET to do so?

Thanks in advance
 
Ad

Advertisements

G

Guest

RSACryptoServiceProvider is designed such that
encrypt can only be done using the public key,
and decrypt can only be done using the private
key. I would like the functionality to do the
opposite.

Thanks

Sergey Bogdanov said:
To encrypt data using a private key you can you RSACryptoServiceProvider
from
http://www.opennetcf.org/sourcebrow...rity/Cryptography/RSACryptoServiceProvider.cs

RSACryptoServiceProvider csp = new RSACryptoServiceProvider();
byte [] encryptedData = csp.EncrpytValue(yourData)
string rsaObj = csp.ToXmlString(false); // export RSA object with
private key


Best regards,
Sergey Bogdanov


Tyler said:
I want to encrypt some data with a private key. How?

As far as I know, public/private key cryptology is supposed to allow for
data to be encrypted by either key and decrypted with the other key.

Given this, why is it that everyingthing in .NET (as far as I can see) only
allows for encrypting data using a public key? Surely there are situations
where encrypting data with a private key is useful. I fully understand public
key encryption's usefullness for passing a symetric key, but here's my
situation.

I have clients running an app. I want to send them some data. I do not care
who reads this data. I only care about 2 things.

1) No one but me could have written that data.
2) The data can not be altered without being corrupted.

Encrypting said data using my private key seems it would do just that. But
how do I use .NET to do so?

Thanks in advance
 
S

Sergey Bogdanov

As I correctly understood you, there are two requirements:

1) No one but me could have written that data.
2) The data can not be altered without being corrupted.

The sender has a private key, the recipient has a public key. Before the
sender will send data it uses SignData method to approve that he is
correct author and no one can't modify this data (otherwise a
verification of signature will fail). When the recipient will recieved
data it must call VerifyData to ensure that no one modify this data.

HTH,
Sergey Bogdanov
http://www.sergeybogdanov.com

Tyler said:
RSACryptoServiceProvider is designed such that
encrypt can only be done using the public key,
and decrypt can only be done using the private
key. I would like the functionality to do the
opposite.

Thanks

:

To encrypt data using a private key you can you RSACryptoServiceProvider
from
http://www.opennetcf.org/sourcebrow...rity/Cryptography/RSACryptoServiceProvider.cs

RSACryptoServiceProvider csp = new RSACryptoServiceProvider();
byte [] encryptedData = csp.EncrpytValue(yourData)
string rsaObj = csp.ToXmlString(false); // export RSA object with
private key


Best regards,
Sergey Bogdanov


Tyler said:
I want to encrypt some data with a private key. How?

As far as I know, public/private key cryptology is supposed to allow for
data to be encrypted by either key and decrypted with the other key.

Given this, why is it that everyingthing in .NET (as far as I can see) only
allows for encrypting data using a public key? Surely there are situations
where encrypting data with a private key is useful. I fully understand public
key encryption's usefullness for passing a symetric key, but here's my
situation.

I have clients running an app. I want to send them some data. I do not care
who reads this data. I only care about 2 things.

1) No one but me could have written that data.
2) The data can not be altered without being corrupted.

Encrypting said data using my private key seems it would do just that. But
how do I use .NET to do so?

Thanks in advance
 
G

Guest

Hashing is one-way, so if I hashed the data and sent the hash then I couldn't
read the data, but rather just the hash right?

Perhaps I could sign a hash, then send the original data along with the
signed hash. That would be enough to verify that the data is valid and that
it was sent from me.

Thanks
 
Ad

Advertisements

G

Guest

SignData, yes that looks like it will work. If I understand that correctly,
SignData creates a hash of my data, then signs it or rather encrypts the hash
using my private key.

So I would need to send the original data along with the signed hash, the
client could read the original data and also verify it thus satisfying my
requirements.

Thanks


Sergey Bogdanov said:
As I correctly understood you, there are two requirements:

1) No one but me could have written that data.
2) The data can not be altered without being corrupted.

The sender has a private key, the recipient has a public key. Before the
sender will send data it uses SignData method to approve that he is
correct author and no one can't modify this data (otherwise a
verification of signature will fail). When the recipient will recieved
data it must call VerifyData to ensure that no one modify this data.

HTH,
Sergey Bogdanov
http://www.sergeybogdanov.com

Tyler said:
RSACryptoServiceProvider is designed such that
encrypt can only be done using the public key,
and decrypt can only be done using the private
key. I would like the functionality to do the
opposite.

Thanks

:

To encrypt data using a private key you can you RSACryptoServiceProvider
from
http://www.opennetcf.org/sourcebrow...rity/Cryptography/RSACryptoServiceProvider.cs

RSACryptoServiceProvider csp = new RSACryptoServiceProvider();
byte [] encryptedData = csp.EncrpytValue(yourData)
string rsaObj = csp.ToXmlString(false); // export RSA object with
private key


Best regards,
Sergey Bogdanov


Tyler Laing wrote:

I want to encrypt some data with a private key. How?

As far as I know, public/private key cryptology is supposed to allow for
data to be encrypted by either key and decrypted with the other key.

Given this, why is it that everyingthing in .NET (as far as I can see) only
allows for encrypting data using a public key? Surely there are situations
where encrypting data with a private key is useful. I fully understand public
key encryption's usefullness for passing a symetric key, but here's my
situation.

I have clients running an app. I want to send them some data. I do not care
who reads this data. I only care about 2 things.

1) No one but me could have written that data.
2) The data can not be altered without being corrupted.

Encrypting said data using my private key seems it would do just that. But
how do I use .NET to do so?

Thanks in advance
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top