locked
X509Certificate2 RRS feed

  • Question

  • HI:

       There is an funtion :

         static byte[] GenerateSignedMessage(byte[] uniqueDeviceNumber, X509Certificate2 oemsigningCert)
            {
                ContentInfo contentInfo = new ContentInfo(uniqueDeviceNumber);
                SignedCms signedCms = new SignedCms(contentInfo, true);
                CmsSigner signer = new CmsSigner(oemsigningCert);
                signedCms.ComputeSignature(signer);
                return signedCms.Encode();
             }

           how to do it by vc++ ?

          Best Regards

          thanks.

    Thursday, July 31, 2014 8:29 AM

Answers

  • Hi,

    In general I would always suggest to not simply convert stuff from one language to another. Even that there might be tools:

    But feel free to look for such tools. Google showed me http://www.tangiblesoftwaresolutions.com/Product_Details/CSharp_to_CPlusPlus_Converter_Details.html as an example.

    //.h file code:
    
    static unsigned char *GenerateSignedMessage(unsigned char uniqueDeviceNumber[], X509Certificate2 *oemsigningCert);
    
    //.cpp file code:
    
    unsigned char *<missing_class_definition>::GenerateSignedMessage(unsigned char uniqueDeviceNumber[], X509Certificate2 *oemsigningCert)
    {
    			ContentInfo *contentInfo = new ContentInfo(uniqueDeviceNumber);
    			SignedCms *signedCms = new SignedCms(contentInfo, true);
    			CmsSigner *signer = new CmsSigner(oemsigningCert);
    			signedCms->ComputeSignature(signer);
    			return signedCms->Encode();
    }

    Have a nice day!

    Kristin

    • Marked as answer by Kristin Xie Thursday, August 7, 2014 7:56 AM
    Friday, August 1, 2014 3:57 AM

All replies