Oliver yes I did try that but it still doesn't seem to work as I would expect. 

Heres a bit more background to the problem. 

Using this Java code:

// Generate the certificate signing request
            PKCS10CertificationRequestBuilder csrBuilder = new 
PKCS10CertificationRequestBuilder(entityName, publicKeyInfo);
            
csrBuilder.addAttribute(PKCSObjectIdentifiers.pkcs_9_at_challengePassword, new 
DERPrintableString(new String("lexicon".toCharArray())));
            ContentSigner signer = signerBuilder.build(entityPair.getPrivate());
            PKCS10CertificationRequest csr = csrBuilder.build(signer);
           System.out.println(csr);

It returns this:

org.bouncycastle.pkcs.PKCS10CertificationRequest@ba259522


However when I try to do the same using JRuby with this code:

// Generate the certificate signing request
csrbuilder = PKCS10CertificationRequestBuilder.new(entityname, publickeyinfo )
password = String.new("password").toCharArray
csrbuilder.addAttribute(PKCSObjectIdentifiers::pkcs_9_at_challengePassword, 
DERPrintableString.new(String.new(password))) 
signer = signerbuilder.build(entitypair.getPrivate)
csr = csrbuilder.build(signer)
puts csr

It returns this:

org.bouncycastle.pkcs.PKCS10CertificationRequestHolder@c06a2100

Instead of returning org.bouncycastle.pkcs.PKCS10CertificationRequest object.




On 17 Oct 2012, at 20:07, Charles Oliver Nutter <head...@headius.com> wrote:

> Yes, I think I was confused by your terminology.
> 
> Assuming the original Java code is right, here's the Ruby code:
> 
> csr = csrBuilder.build(signer)
> 
> - Charlie
> 
> On Wed, Oct 17, 2012 at 2:03 PM, Carl Bourne <carl.bou...@me.com> wrote:
>> Charles,
>> 
>> Maybe I'm getting my terminology mixed up here.
>> 
>> I basically have two different types of object .
>> 
>>>> PKCS10CertificationRequestHolder and a
>>>> PKCS10CertificationRequest
>> 
>> In order for me to pass the holder object to another class the holder object 
>> needs to be just a request object as per my Java example. I may be missing 
>> something obvious here, but how would I do this in JRuby?
>> 
>> Regards,
>> 
>> Carl
>> 
>> 
>> Carl Bourne | Senior Sales Engineer | mobile: +44 (0) 7770 284294 | 
>> www.venafi.com
>> 
>> On 17 Oct 2012, at 19:43, Charles Oliver Nutter <head...@headius.com> wrote:
>> 
>>> There's no casting (in the usual Java sense) required in JRuby; if the
>>> methods exist, they'll be callable. Just go with it :)
>>> 
>>> - Charlie
>>> 
>>> On Wed, Oct 17, 2012 at 1:08 PM, Carl Bourne <carl.bou...@me.com> wrote:
>>>> Hi,
>>>> 
>>>> I need to do the equivalent of this in JRuby:--
>>>> 
>>>> PKCS10CertificationRequest csr = csrBuilder.build(signer);
>>>> 
>>>> Which equates to what I think is casting a 
>>>> "org.bouncycastle.pkcs.PKCS10CertificationRequestHolder" object to a  
>>>> "org.bouncycastle.pkcs.PKCS10CertificationRequest" object.
>>>> 
>>>> Is this possible?
>>>> 
>>>> Regards,
>>>> 
>>>> Carl
>>>> 
>>>> ---------------------------------------------------------------------
>>>> 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
>>> 
>>> 
>> 
>> ---------------------------------------------------------------------
>> 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
> 
> 


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

    http://xircles.codehaus.org/manage_email


Reply via email to