Re: Question about signing XML and RSA

From: Pieter Philippaerts (Pieter_at_nospam.mentalis.org)
Date: 02/24/04


Date: Tue, 24 Feb 2004 09:31:36 +0100


"David Lindgren" <david.lindgren@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



Relevant Pages

  • Re: Question about signing XML and RSA
    ... > that initiating the RSA key with either RSA.Createor FromXMLString ... That's because the default constructor of the RSACryptoServiceProvider ... If you store your keys in a CryptoAPI key store, ...
    (microsoft.public.dotnet.xml)
  • Re: Question about signing XML and RSA
    ... >> that initiating the RSA key with either RSA.Createor FromXMLString ... > That's because the default constructor of the RSACryptoServiceProvider ... > If you store your keys in a CryptoAPI key store, ... > RSACryptoServiceProvider instance. ...
    (microsoft.public.dotnet.xml)
  • Re: Question about signing XML and RSA
    ... >> that initiating the RSA key with either RSA.Createor FromXMLString ... > That's because the default constructor of the RSACryptoServiceProvider ... > If you store your keys in a CryptoAPI key store, ... > RSACryptoServiceProvider instance. ...
    (microsoft.public.dotnet.security)
  • Re: CryptAcquireContext question!
    ... It is an RSA key. ... On the other way a want to acces from my CSP to the ... Certificate store MY. ... >> that identifies the key container to the CSP. ...
    (microsoft.public.platformsdk.security)