[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[iaik-jce] UnknownExtensions and ObjectIDs



Greetings gurus:
 
I am creating certificates with custom extensions, for which I must use the UnknownExtension class.  My code looks something like this:
 
  public m_cert = new X509Certificate();
 
  private void addVerificationExtension()
  {
    try
    {
      OCTET_STRING extValue = new OCTET_STRING(big bag of bytes);
      V3Extension customExtension = new UnknownExtension(new ObjectID("9.45.12345.17.8",
           "CUSTOM_EXTENSION", "CUSTOM");
      customExtension.setCritical(true);
      verificationExtension.init(extValue);
      m_cert.addExtension(customExtension);
    }
    catch (X509ExtensionException xee)
    {
      // some handling
      xee.printStackTrace();
    }
  }
 
The trouble is with the ObjectID that I construct inside the UnknownExtension constructor.  It works fine, but when I view the certificate produced in a .cer file, the string value for the field is different("2.29.12345.17.8" as opposed to "9.45.12345.17.8"); and if I want to retrieve the value I have to create an ObjectID with the new string value.
 
Any thoughts on what I'm doing wrong here would be appreciated.
 
Aaron Haspel