Tom,

Thanks for the reply, I tried 'require openssl' but got a whole load of 
constant already initialised warnings. Then an error saying it could not load 
openssl/dummy! 

I'm also using BC 1.4.7 so I'm wondering if that could be the problem! 

Regards,

Carl Bourne

On 16 Jan 2013, at 20:15, Thomas E Enebo <tom.en...@gmail.com> wrote:

> 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
> 
> 

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

    http://xircles.codehaus.org/manage_email


Reply via email to