3

How do I generate a public and a private key for the DSA algorithm in byte array format?

Bryce Wagner
  • 2,640
  • 1
  • 26
  • 43
Nicola
  • 621
  • 10
  • 22

1 Answers1

10

In DSA algorithm (from wiki):

  • Public key is (p, q, g, y).
  • Private key is x.

        var dsa = new DSACryptoServiceProvider();            
        var privateKey = dsa.ExportParameters(true); // private key
        var publicKey = dsa.ExportParameters(false); // public key
    

In publicKey it's P, Q, G, Y propertyes

In privateKey it's X

And don't forget to accept this answer!

Alexander Molodih
  • 1,928
  • 2
  • 20
  • 30