Tag Archives: Public Key

Cryptography #2

So, it turns out I couldn’t generate public keys from private ones using Diffie-Hellman algorithm, it took several minutes for even a limited size private key.

In the end I went back to visual basic and after lots of researching(thanks stackoverflow) I got a handle on how to extract(export) private and public keys.
That may be unnecessary though, I can simply send a signature with the algorithm I’m using(one called “ECDsa”). If I were to save the private key I’d need to authorize it at object(Security.Cryptography.CngKey) instantiation.

I need to send the public key even if I have a signature. No idea why I said I didn’t need to. I spent most of the previous days trying to accomplish just that.

Leave a comment

Filed under Uncategorized


Asides from GUI this seems to be the second major weakness in python. No public/private key generator. To make things worse, visual studio documentation doesn’t seem simple either. It has all stuff I probably need but it’s confusing. Does CngKey refers to a public or private key? And how do I store it in a plain text file?

Here is what I really needed:

Gets a new private key that is random/prime/secure/etc

Gets the matching public key

Gets a shared secret(that I’ll use in a keyed hash, like hmac)

Done. I could implement that in Python but I am 99% sure I would make a serious mistake and expose the private key.

I don’t want a certificate or to associate either key or the shared secret with any company or person. Just to have that link between private and public key.

Leave a comment

Filed under Uncategorized