0

I want to request a cert (from AD cert server) using a template. I want to supply the public key in the request. Using msft's SDK sample

        IX509CertificateRequest iRequest = objEnroll.Request;

        // then get the inner PKCS10 request
        IX509CertificateRequest iInnerRequest = 
            iRequest.GetInnerRequest(InnerRequestLevel.LevelInnermost);
        IX509CertificateRequestPkcs10 iRequestPkcs10 = 
            iInnerRequest as IX509CertificateRequestPkcs10;

        // create CX500DistinguishedName
        CX500DistinguishedName objName = new CX500DistinguishedName();
        objName.Encode(subjectName, X500NameFlags.XCN_CERT_NAME_STR_NONE);

        // set up the subject name
        iRequestPkcs10.Subject = objName;

I think I then need to do some thing like this

         iRequestPkcs10.PublicKey.InitializeFromEncodedPublicKeyInfo(xx);

but I dont know what xx is. I have the public key (In a bouncy castle PKCS10 object), but what format must it be in to pass to this function?

pm100
  • 48,078
  • 23
  • 82
  • 145

1 Answers1

0

You can specify the public key in a number of different formats.

According to MSDN, InitializeFromEncodedPublicKeyInfo takes two parameters: the first is the public key, and the second is an EncodingType enumeration value that specifies the format of the public key you are supplying.

Cocowalla
  • 13,822
  • 6
  • 66
  • 112
  • Thx, THis only gives the syntactical encoding (base64, raw hex etc). It doesnt say what data type is expected; I mean if its base64 what bytes were input to the base64 conversion – pm100 Aug 15 '11 at 21:35
  • Ah, I see. Is this any help? http://msdn.microsoft.com/en-us/library/aa379039%28v=VS.85%29.aspx – Cocowalla Aug 17 '11 at 20:40