title: PKCS#10 request for a object key pair from PKCS#11
body: <p>I have a RSA 1024 key pair generated using standard call from PKCS#11. 
  I need to generate a PKCS#10 CSR for the public key.</p>
  
  <p>MS has the IEnroll4 dll which will allow to raise a CSR using createRequestWStr. The samples indicate that you need to generate a new key pair(a container with 2 objects in MS CAPI) and MS automatically gives the the public key context for csr generation. </p>
  
  <p>In my case, I already have a key pair generated using pkcs#11(as 2 objects but no key container). MS dll is not allowing me to proceed further.
  QUERY 1:
  Can some body point out how I can resolve this issue.
  <strong>----------------------------------------------------------------------------</strong></p>
  
  <p>Alternatively, I was thinking to write my own code for CSR generation based on RSA standards. I am having the ASN 1.0 format
  The ASN.1 syntax for a Certification Request is:</p>
  
  <pre><code>CertificationRequest ::= SEQUENCE {
     certificationRequestInfo CertificationRequestInfo,
     signatureAlgorithm       SignatureAlgorithmIdentifier,
     signature                Signature
  }
  
  SignatureAlgorithmIdentifier ::= AlgorithmIdentifier
  Signature ::= BIT STRING
  
  CertificationRequestInfo ::= SEQUENCE {
     version                 Version,
     subject                 Name,
     subjectPublicKeyInfo    SubjectPublicKeyInfo,
     attributes [0] IMPLICIT Attributes
  }    
  Attributes ::= SET OF Attribute
  </code></pre>
  
  <p>QUERY 2:
  How do I use the above syntaxes?  I am totally new to this syntax? Which resources should I need to look at to write my own code?</p>