Perhaps require 'openssl' first?  The problem I think is that if you
are loading bc you are doing it from a child classloader from the main
CL where JRuby has already loaded BC.  It is just a guess though.

-Tom

On Wed, Jan 16, 2013 at 1:08 PM, Carl Bourne <carl.bou...@me.com> wrote:
> Hi,
>
> I'm trying to create a new Certificate Signing Request () using the
> BouncyCastle libraries. I can generate a basic CSR without the code between
> the #Begin and end add extension. However when I try to add the
> DERObjectIdentifier I get an "NoMethodError: undefined method
> `DERObjectIdentifier' for #<ScepEnroler:0x6cf6cb21>" error.
>
> Any assistance would be appreciated.
>
> Best Regards,
>
> Carl
>
>
>
>
> java_import org.bouncycastle.asn1.DERPrintableString
> java_import org.bouncycastle.asn1.DERObjectIdentifier
>
> entityname = X500Name.new("#{@entityname}")
>
> newentitypair = KeyPairGenerator.getInstance("RSA")
> newentitypair.initialize__method(2048)
>
> entitypair = newentitypair.genKeyPair
>
> publickeyinfo =
> SubjectPublicKeyInfo.getInstance(entitypair.getPublic.getEncoded)
>
> csrbuilder = PKCS10CertificationRequestBuilder.new(entityname, publickeyinfo
> )
> puts csrbuilder
>
> csrbuilder.addAttribute(PKCSObjectIdentifiers::pkcs_9_at_challengePassword,
> DERPrintableString.new("#{@challengepassword}"))
>
> #Begin add extension
>
> extensionsGenerator = org.bouncycastle.asn1.x509.ExtensionsGenerator.new
>
> vec = ASN1EncodableVector.new
> v = ASN1EncodableVector.new
>
> v.add(DERObjectIdentifier("1.3.6.1.4.1.311.20.2.3").new)
> v.add(DERTaggedObject(true, 0, DERUTF8String("devuser@dvam.local").new
> ).new)
>
> ASN1Object gn = DERTaggedObject(false, 0, DERSequence(v).new).new
> vec.add(gn)
>
> extensionsGenerator.addExtension( Extension.subjectAlternativeName, true,
> DERSequence(vec).new )
> csrbuilder.addAttribute( PKCSObjectIdentifiers.pkcs_9_at_extensionRequest,
> extensionsGenerator.generate() )
>
> #End add extension
>
> signer = signerbuilder.build(entitypair.getPrivate)
> puts signer
> csr = csrbuilder.build(signer)
>



-- 
blog: http://blog.enebo.com       twitter: tom_enebo
mail: tom.en...@gmail.com

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to