Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. conceptual question about cryptography and CAPICOM

conceptual question about cryptography and CAPICOM

Scheduled Pinned Locked Moved C#
questioncryptography
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pelos
    wrote on last edited by
    #1

    hello, I am trying to sign data with a CAPICOM.SignedData object. The SignedData object has got a method called Sign() which performs the operation and this method has got a parameter called Signer which (according to the CAPICOM reference) "must have access to the private key of the certificate used to sign". I had understood that a public key certificate contains the subject's public key. so, I think that "the private key of the certificate used to sign" means that the certificate does not contain the subject's private key but that is associated with it. My questions are: 1. how is this association? 2. where is stored the private key? 3. how can I obtain a signing private key? thanks in advance:-D

    H 1 Reply Last reply
    0
    • P pelos

      hello, I am trying to sign data with a CAPICOM.SignedData object. The SignedData object has got a method called Sign() which performs the operation and this method has got a parameter called Signer which (according to the CAPICOM reference) "must have access to the private key of the certificate used to sign". I had understood that a public key certificate contains the subject's public key. so, I think that "the private key of the certificate used to sign" means that the certificate does not contain the subject's private key but that is associated with it. My questions are: 1. how is this association? 2. where is stored the private key? 3. how can I obtain a signing private key? thanks in advance:-D

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      Don't use CAPICOM (an interop library). Almost all the functionality of the CryptoAPI is encapsulates in the System.Security.Cryptography namespace and child namespaces and is written to support .NET while using the CAPICOM requires marshalling and isn't always .NET-friendly. When you sign data, you sign with your private key. This allows the recipient(s) to verify your signature (an encrypted digest of the clear-text, typically) using your public key. RSA uses the same signature and encryption algorithms, where DSA uses different algorithms (more secure). The private key is maintained soley by the user. It should never be uploaded to a PKI server or be available for others. That would defeat the whole purpose of public key encryption. Only the public key is made public, hence the name. If you're trying to access your private key, you must provide CSP (cryptographic service provider) information to use a CSP (software-based, smart card, etc.) that contains a private key, as well as how to access that private key. If you want, see my list of articles (link to them in my sig) for the XML Digital Signatures article. That contains information about using XML signatures and the SignedXml and SignedInfo classes to access your private key in a software-based provider (used by the sn.exe .NET Framework utility app) using the right index into the right key provider.

      Microsoft MVP, Visual C# My Articles

      P 1 Reply Last reply
      0
      • H Heath Stewart

        Don't use CAPICOM (an interop library). Almost all the functionality of the CryptoAPI is encapsulates in the System.Security.Cryptography namespace and child namespaces and is written to support .NET while using the CAPICOM requires marshalling and isn't always .NET-friendly. When you sign data, you sign with your private key. This allows the recipient(s) to verify your signature (an encrypted digest of the clear-text, typically) using your public key. RSA uses the same signature and encryption algorithms, where DSA uses different algorithms (more secure). The private key is maintained soley by the user. It should never be uploaded to a PKI server or be available for others. That would defeat the whole purpose of public key encryption. Only the public key is made public, hence the name. If you're trying to access your private key, you must provide CSP (cryptographic service provider) information to use a CSP (software-based, smart card, etc.) that contains a private key, as well as how to access that private key. If you want, see my list of articles (link to them in my sig) for the XML Digital Signatures article. That contains information about using XML signatures and the SignedXml and SignedInfo classes to access your private key in a software-based provider (used by the sn.exe .NET Framework utility app) using the right index into the right key provider.

        Microsoft MVP, Visual C# My Articles

        P Offline
        P Offline
        pelos
        wrote on last edited by
        #3

        thank you, Heath. if i dont use CAPICOM, how can i create a CMS/PKCS#7 (SignedData) structure? I think there is not a PKCS#7 structure in the .NET class library. ahhh! I think that the response to my question (how is the association between a public-key certificate and the signing private key) was the PKCS#12 structure, wasn't it? thanks.

        H 1 Reply Last reply
        0
        • P pelos

          thank you, Heath. if i dont use CAPICOM, how can i create a CMS/PKCS#7 (SignedData) structure? I think there is not a PKCS#7 structure in the .NET class library. ahhh! I think that the response to my question (how is the association between a public-key certificate and the signing private key) was the PKCS#12 structure, wasn't it? thanks.

          H Offline
          H Offline
          Heath Stewart
          wrote on last edited by
          #4

          Yes. IIRC, the PKCS12 structure can store more information, but I really haven't worked too much with such types of storage structures. Most references to such structures I see are typically PKCS12, however.

          Microsoft MVP, Visual C# My Articles

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups