473,320 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Encryption, PGP, and .NET

Hi there,

I read a Microsoft paper explaining the basic concepts of encryption.
For example, I now understand the difference between asymmetric and
symmetric encryption and have successfully used the .NET crypto classes.

I'm now working on a project where I need to download a file from a bank
and process it. The bank's policy is encrypt the file using something called
a "PGP key." I need a way to decrypt it but I'm not sure where to start.
According to the admin at the bank, PGP is an asymmetric algorithm. I
interpreted this to mean that I would give the admin at the bank a public
key which he would use to encrypt the file and when I receive it, I'd
decrypt it with my private key. Correct?

So, I used the .NET classes to create the following public key and I
sent it to the admin at the bank:

<RSAKeyValue><Modulus>151Vw6Kq51bpblahblahblahWCkP mD345ncclzFrmeb9fjpE+B6VsIAqP3kahu00p33BmFpDpXOcgi uRC2En0HoGqyZB9ifvNlPhT7flZ1uVuC9JtywG3FmYRsqbpJuT 7VTIAHYExU6T/FyRuyIbhdUVwhue7ARaObsEWszE1IoM7+XcYYs=</Modulus><Exponent>AQAB</Exponent><P>+7OU6YErvfk84O/2bX5s2753xE+pdiyJl3j8gy4zMh4UKeKVhyxgSJJCvNTl9XVIy a6xnCWPkHVy8ylNqyLiHQ==</P><Q>20v7/nODe/jKcbsiYEwzGXp0ZyiG17JqzOBKrDFu6bwPiAEHzZln0CYfUn0E hJdCmetaq9WFXk27mbK3Z6aBxw==</Q><DP>RpoN6B26dlRGFlZZCkePI2he0esCfsppYdqnAejgpWs4 frM2/C6fZ1vXan5RbrOSUjg1S7ZhecToFHr+dUWYpQ==</DP><DQ>ayaHbF7YwfxgPo3nUBIrbamNstH0gPQmhxCYq+ZDgWV oWVXXkDgCp4vZBh8b1AVsf3SmCwv7bIaiwYi3YKfVBQ==</DQ><InverseQ>YjvieMYPEDdUHqSZRWAsFlEESd3NczFCrbBaS HzbsbOZeDrccvUfoOP2jeIhuMt0qQwMqXY/NJau9Ldwdx7xNw==</InverseQ><D>wEg6bM5LVSWoQgWpoldz5dQWfQjqQVc8WzKpDA HQ8ejsm0ug4ZwRcRRnKZs3o7OTsiAJCfjqT9ij1gKMoeLrXIM1 RDOcAYBxI0qwWdRrr3sbar7ntMYmy4tlTTf8/G+ypw+CJi1gz2umswcx4MHhNTUGTUHSmjEjDTFfh3sW64k=</D></RSAKeyValue>

He said that he had never seen a key like this before. He said that the
public key that I generate should look something like this:

---BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.2.6 (GNU/Linux)

mQGiBD7ca+gRBADND4XM/Gb8HkdhPZ82AgVjKPUElAH4ohBnG0Fu/YHKmzqJWoB5
8uGnmXY5UYa2t1m//JluwJa/Dlb+1qlEXgZcDyTUFL/++le/a3yI2QQEo1XCO/VD

...and so on, blah blah
-----END PGP PUBLIC KEY BLOCK-----

Which begs the following questions:

How do I create a public PGP key using .NET?
How do I create a *private* PGP key using .NET?
How do I decrypt a PGP file using .NET?

Thanks,

Jules Winfield
Mar 23 '06 #1
3 9201
Dave/Jules Winfield,

PGP is asymmetric, correct.

PGP is a proprietary (as in not quite "open") asymmetric algorithm.
There are open implementations of PGP however. See www.gnupg.org for that.

What I've done in the past is use C# and the Process and ProcessInfo
classes to call pgp.exe from gnupg.org and do the encryption/decryption
that way.

There is no native C# pgp implementation that I'm aware of.

The key you sent looks to be some kind of RSA key, but I'm guessing that
just from the XML tag that encompasses it. RSA != PGP.

jeremiah();
The One We Call 'Dave' wrote:
Hi there,

I read a Microsoft paper explaining the basic concepts of encryption.
For example, I now understand the difference between asymmetric and
symmetric encryption and have successfully used the .NET crypto classes.

I'm now working on a project where I need to download a file from a bank
and process it. The bank's policy is encrypt the file using something called
a "PGP key." I need a way to decrypt it but I'm not sure where to start.
According to the admin at the bank, PGP is an asymmetric algorithm. I
interpreted this to mean that I would give the admin at the bank a public
key which he would use to encrypt the file and when I receive it, I'd
decrypt it with my private key. Correct?

So, I used the .NET classes to create the following public key and I
sent it to the admin at the bank:

<RSAKeyValue><Modulus>151Vw6Kq51bpblahblahblahWCkP mD345ncclzFrmeb9fjpE+B6VsIAqP3kahu00p33BmFpDpXOcgi uRC2En0HoGqyZB9ifvNlPhT7flZ1uVuC9JtywG3FmYRsqbpJuT 7VTIAHYExU6T/FyRuyIbhdUVwhue7ARaObsEWszE1IoM7+XcYYs=</Modulus><Exponent>AQAB</Exponent><P>+7OU6YErvfk84O/2bX5s2753xE+pdiyJl3j8gy4zMh4UKeKVhyxgSJJCvNTl9XVIy a6xnCWPkHVy8ylNqyLiHQ==</P><Q>20v7/nODe/jKcbsiYEwzGXp0ZyiG17JqzOBKrDFu6bwPiAEHzZln0CYfUn0E hJdCmetaq9WFXk27mbK3Z6aBxw==</Q><DP>RpoN6B26dlRGFlZZCkePI2he0esCfsppYdqnAejgpWs4 frM2/C6fZ1vXan5RbrOSUjg1S7ZhecToFHr+dUWYpQ==</DP><DQ>ayaHbF7YwfxgPo3nUBIrbamNstH0gPQmhxCYq+ZDgWV oWVXXkDgCp4vZBh8b1AVsf3SmCwv7bIaiwYi3YKfVBQ==</DQ><InverseQ>YjvieMYPEDdUHqSZRWAsFlEESd3NczFCrbBaS HzbsbOZeDrccvUfoOP2jeIhuMt0qQwMqXY/NJau9Ldwdx7xNw==</InverseQ><D>wEg6bM5LVSWoQgWpoldz5dQWfQjqQVc8WzKpDA HQ8ejsm0ug4ZwRcRRnKZs3o7OTsiAJCfjqT9ij1gKMoeLrXIM1 RDOcAYBxI0qwWdRrr3sbar7ntMYmy4tlTTf8/G+ypw+CJi1gz2umswcx4MHhNTUGTUHSmjEjDTFfh3sW64k=</D></RSAKeyValue>

He said that he had never seen a key like this before. He said that the
public key that I generate should look something like this:

---BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.2.6 (GNU/Linux)

mQGiBD7ca+gRBADND4XM/Gb8HkdhPZ82AgVjKPUElAH4ohBnG0Fu/YHKmzqJWoB5
8uGnmXY5UYa2t1m//JluwJa/Dlb+1qlEXgZcDyTUFL/++le/a3yI2QQEo1XCO/VD

...and so on, blah blah
-----END PGP PUBLIC KEY BLOCK-----

Which begs the following questions:

How do I create a public PGP key using .NET?
How do I create a *private* PGP key using .NET?
How do I decrypt a PGP file using .NET?

Thanks,

Jules Winfield

Mar 23 '06 #2
jeremiah johnson wrote:
There is no native C# pgp implementation that I'm aware of.


Somone built a c# wrapper for Gnu PG.

I use it all the time:

http://www.codeproject.com/csharp/gnupgdotnet.asp

It's configured as an ASP project, but I use it in a web service and a
windows service.

You still need to install GnuPG. There is a windows version that you
can find on the Gnu PG site.
--
Get the new
http://www.you-read-it-here-first.com
content from Texeme Textcasting Technology
Mar 23 '06 #3
"The One We Call 'Dave'" <gh****@englewood.com> wrote in message
news:Hr********************@giganews.com...
Hi there,

I read a Microsoft paper explaining the basic concepts of encryption.
For example, I now understand the difference between asymmetric and
symmetric encryption and have successfully used the .NET crypto classes.

I'm now working on a project where I need to download a file from a
bank and process it. The bank's policy is encrypt the file using something
called a "PGP key." I need a way to decrypt it but I'm not sure where to
start. According to the admin at the bank, PGP is an asymmetric algorithm.
I interpreted this to mean that I would give the admin at the bank a
public key which he would use to encrypt the file and when I receive it,
I'd decrypt it with my private key. Correct?

So, I used the .NET classes to create the following public key and I
sent it to the admin at the bank:

<RSAKeyValue><Modulus>151Vw6Kq51bpblahblahblahWCkP mD345ncclzFrmeb9fjpE+B6VsIAqP3kahu00p33BmFpDpXOcgi uRC2En0HoGqyZB9ifvNlPhT7flZ1uVuC9JtywG3FmYRsqbpJuT 7VTIAHYExU6T/FyRuyIbhdUVwhue7ARaObsEWszE1IoM7+XcYYs=</Modulus><Exponent>AQAB</Exponent><P>+7OU6YErvfk84O/2bX5s2753xE+pdiyJl3j8gy4zMh4UKeKVhyxgSJJCvNTl9XVIy a6xnCWPkHVy8ylNqyLiHQ==</P><Q>20v7/nODe/jKcbsiYEwzGXp0ZyiG17JqzOBKrDFu6bwPiAEHzZln0CYfUn0E hJdCmetaq9WFXk27mbK3Z6aBxw==</Q><DP>RpoN6B26dlRGFlZZCkePI2he0esCfsppYdqnAejgpWs4 frM2/C6fZ1vXan5RbrOSUjg1S7ZhecToFHr+dUWYpQ==</DP><DQ>ayaHbF7YwfxgPo3nUBIrbamNstH0gPQmhxCYq+ZDgWV oWVXXkDgCp4vZBh8b1AVsf3SmCwv7bIaiwYi3YKfVBQ==</DQ><InverseQ>YjvieMYPEDdUHqSZRWAsFlEESd3NczFCrbBaS HzbsbOZeDrccvUfoOP2jeIhuMt0qQwMqXY/NJau9Ldwdx7xNw==</InverseQ><D>wEg6bM5LVSWoQgWpoldz5dQWfQjqQVc8WzKpDA HQ8ejsm0ug4ZwRcRRnKZs3o7OTsiAJCfjqT9ij1gKMoeLrXIM1 RDOcAYBxI0qwWdRrr3sbar7ntMYmy4tlTTf8/G+ypw+CJi1gz2umswcx4MHhNTUGTUHSmjEjDTFfh3sW64k=</D></RSAKeyValue>

He said that he had never seen a key like this before. He said that the
public key that I generate should look something like this:

---BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.2.6 (GNU/Linux)

mQGiBD7ca+gRBADND4XM/Gb8HkdhPZ82AgVjKPUElAH4ohBnG0Fu/YHKmzqJWoB5
8uGnmXY5UYa2t1m//JluwJa/Dlb+1qlEXgZcDyTUFL/++le/a3yI2QQEo1XCO/VD

..and so on, blah blah
-----END PGP PUBLIC KEY BLOCK-----

Which begs the following questions:

How do I create a public PGP key using .NET?
How do I create a *private* PGP key using .NET?
How do I decrypt a PGP file using .NET?

Thanks,

Jules Winfield


We've used this extensivly to support PGP encryption and decryption in C#:

http://community.wow.net/grt/nsdpgp.html

It's a COM wrapper for PGP, I believe supporting versions 8 and 9 of PGP.
The caveat is that you must have a copy of PGP installed to use it.

CVD
Mar 23 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Cliff | last post by:
We are trying to connect to 3 different Oracle databases using MS Access as the front-end and ODBC as the connection. The problem that we are having is that 1 of the databases requires a...
113
by: Bonj | last post by:
I was in need of an encryption algorithm to the following requirements: 1) Must be capable of encrypting strings to a byte array, and decyrpting back again to the same string 2) Must have the same...
7
by: Alan Silver | last post by:
Hello, I am writing a page where sensitive data is collected (over SSL) and stored in a database. I have been looking at the .NET encryption classes, but am a bit confused as to which is best...
2
by: Sumit Gupta | last post by:
Can anyone please tell me how to encrpt string or any kind of Data. Also the Algorithm of Compression. Any Link tutorial etc. Like : Zip or RAR Formats etc.
9
by: sweety | last post by:
Dear All, How to encrypt a C data file and make binary file and then have to read a bin file at run time and decrypt the file and have to read the data. Any help to achive this pls. Would be...
4
by: pintu | last post by:
Hello everybody.. I hav some confusion regarding asymmetric encryption.As asymmetric encryption it there is one private key and one public key.So any data is encrypted using private key and the...
1
by: =?Utf-8?B?bWljcm9ob2Y=?= | last post by:
Short version: Is there a way to configure (preferably programmatically) the max encryption strength that will be used by the framework when connecting to a particular SSL-protected web service? ...
11
by: John Williams | last post by:
I've written a simple program to do XOR encryption as my first foray into understanding how encryption works. The code compiles fine, however it segmentation faults on every run. using gdb to...
22
by: j1mb0jay | last post by:
I have had to create a simple string encryption program for coursework, I have completed the task and now have to do a write up on how it could be improved at a later date. If you could look...
19
by: klenwell | last post by:
Another request for comments here. I'd like to accomplish something like the scheme outlined at this page here: http://tinyurl.com/3dtcdr In a nutshell, the form uses javascript to hash...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.