"David Lindgren" <da************@hogia.se.REMOVE!> wrote
I am trying to sign my XML files with private/public keys but I have
noticed that initiating the RSA key with either RSA.Create() or FromXMLString()
takes a lot of time. I wonder why?
That's because the default constructor of the RSACryptoServiceProvider
creates a new public/private key pair whenever it's called.
Is it possible to skip this part and read
in the keys directly? What is the fastest way to get a RSA key to pass
SignedXML.SigningKey ? I have generated keys already.
If you store your keys in a CryptoAPI key store, you can use the
RSACryptoServiceProvider(CspParameters) constructor to initialize an
RSACryptoServiceProvider instance. This is the fastest option because all it
has to do is associate the instance with the stored key.
If you don't want to put your key in a crypto store, you can use the
RSACryptoServiceProvider(int) constructor and pass it '512' to let it
generate a 512-bit key pair [this should be pretty fast] and then import
your key using the FromXMLString() method.
Regards,
Pieter Philippaerts
Managed SSL/TLS:
http://mentalis.org/go.php?sl