none
performance certificate.PrivateKey RRS feed

  • Question

  • Hi,

    I have a performance issue with certificates. It has worked fast, but without code change it became very slow.

    The part that is slow is, 'certificate.PrivateKey'. It take more then two minutes. The certificates aren't changed.


    The code:

    certificate = new X509Certificate2(privateKeyFile.FullName, password, X509KeyStorageFlags.Exportable | X509KeyStorageFlags.MachineKeySet);

    RSACryptoServiceProvider rsa = certificate.PrivateKey as RSACryptoServiceProvider

    Any idea what can cause this issue?

    Saturday, February 9, 2013 4:21 PM

Answers

  • Hi,

    Can you explained more why its related with AD?

    Also I assume that your certificate is a file. If so, can you try below PowerShell code and see if its also have same delay when enumerate the certificate properties.

    PS C:\> $cert1 = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 "C:\<certificate filename>"
    
    PS C:\> $cert1 | fl * -f
    http://blogs.msdn.com/b/adpowershell/archive/2009/04/26/working-with-certificates.aspx

    Regards,
    Christian HL
    Microsoft Online Community Support


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Tuesday, February 12, 2013 7:45 AM

All replies

  • I've found the origin of the problem: Active Directory was slow and this is the consequence...

    Would there be a solution so that Active Directory is not used for this functionality?

    Best regards,

    Stijn.

    Saturday, February 9, 2013 5:54 PM
  • Hi Stijn,

    Welcome to the MSDN Forum.

    I am trying to involve some other one into this case, wait it patiently, please.

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, February 11, 2013 7:45 AM
    Moderator
  • Hi,

    Can you explained more why its related with AD?

    Also I assume that your certificate is a file. If so, can you try below PowerShell code and see if its also have same delay when enumerate the certificate properties.

    PS C:\> $cert1 = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 "C:\<certificate filename>"
    
    PS C:\> $cert1 | fl * -f
    http://blogs.msdn.com/b/adpowershell/archive/2009/04/26/working-with-certificates.aspx

    Regards,
    Christian HL
    Microsoft Online Community Support


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Tuesday, February 12, 2013 7:45 AM