X509Certificate2.HasPrivateKey = true, but no PrivateKey?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dominik Amon

    X509Certificate2.HasPrivateKey = true, but no PrivateKey?

    Hi,

    I have a X509 certifikate, with public- and privatekey.
    For test reasons, I programed a small Consoleapplicat ion, which executes
    with my user rights (Administrator) .

    When I am reading an X509Certificate , the property HasPrivateKey of the
    X509Certificate 2 is set to "true". I can also check the publickey

    But if I want to use the PrivateKey Property, after a while i get the error
    message "Keyset does not exist",

    That's the stacktrace for it:
    bei System.Security .Cryptography.U tils.CreateProv Handle(CspParam eters
    parameters, Boolean randomKeyContai ner)\r\n bei
    System.Security .Cryptography.U tils.GetKeyPair Helper(CspAlgor ithmType
    keyType, CspParameters parameters, Boolean randomKeyContai ner, Int32
    dwKeySize, SafeProvHandle& safeProvHandle, SafeKeyHandle& safeKeyHandle)\ r\n
    bei System.Security .Cryptography.R SACryptoService Provider.GetKey Pair()\r\n
    bei System.Security .Cryptography.R SACryptoService Provider..ctor( Int32
    dwKeySize, CspParameters parameters, Boolean useDefaultKeySi ze)\r\n bei
    System.Security .Cryptography.R SACryptoService Provider..ctor( CspParameters
    parameters)\r\n bei
    System.Security .Cryptography.X 509Certificates .X509Certificat e2.get_PrivateK ey()\r\n
    bei SecurityHelper. SignatureHelper .FindCertificat e(CertificateId entification
    certIdentificat ion, String certAttributeDa ta) in D:\\DATEN\\Amon D\\Visual
    Studio
    2005\\Projects\ \ConsoleApplica tion1\\ConsoleA pplication1\\Si gnatureHelper.c s:Zeile
    120.

    I don't have a plan, what's the reason? :-(

    Thanks,
    Dominik




Working...