[prev in list] [next in list] [prev in thread] [next in thread] 

List:       bouncycastle-crypto-dev
Subject:    Re: [dev-crypto] Importing an existing certificate into TLSClient
From:       Lili Shi <lilidotshi () gmail ! com>
Date:       2011-09-06 14:50:48
Message-ID: CAFA-72YSmWmCwHQULYOmLraduvrtNxidez8GvdNwi+10ExW95g () mail ! gmail ! com
[Download RAW message or body]

Thanks so much for your help Pete. Everything is working great now!
On Sep 1, 2011 9:14 AM, "Peter Dettman" <pkd@lockboxlabs.com> wrote:
> Great. So just call getEncoded() on the private key, which with the BC
> provider will produce a PKCS#8 encoding (check getFormat() if using
> another provider to make sure). Pass the resulting byte[] to
> org.bouncycastle.crypto.util.PrivateKeyFactory.createKey and it should
> return you an AsymmetricKeyParameter.
>
>
> On 1/09/2011 7:42 PM, Lili Shi wrote:
>>
>> My private key is stored in the bks.
>>
>> On Sep 1, 2011 8:39 AM, "Peter Dettman" <pkd@lockboxlabs.com
>> <mailto:pkd@lockboxlabs.com>> wrote:
>> > The AsymmetricKeyParameter has to be the private key corresponding to
>> > your certificate.
>> > How to create the appropriate object will depend on what format you
>> have
>> > the private key available in. So, where is your private key coming
from?
>> >
>> > Cheers,
>> > Pete.
>> >
>> >
>> > On 1/09/2011 7:29 PM, LilidotShi@gmail.com
>> <mailto:LilidotShi@gmail.com> wrote:
>> >> Thanks so much for your help Pete!
>> >>
>> >> I think I'm starting to get the hang of this but I have one more
>> >> question. Creating an instance of DefaultTlsSignerCredentials means
>> >> supplying it with a TLscontext, a clientcert and an
>> >> AsymmetricKeyParameters. I can get the first two, TlsContext, like you
>> >> said is created for me, clientCert I got by converting the certificate
>> >> but how do I create/access AsymmetricKeyParameters, particularly if I
>> >> know it's going to be an instance of elliptic curve parameters?
>> >>
>> >> Again, sorry to bombard you with all these questions but I think once
>> >> I get past this I should be able to make a successful handshake.
>> >>
>> >> Lili
>> >
>> >
>

[Attachment #3 (text/html)]

<p>Thanks so much for your help Pete. Everything is working great now!</p>
<div class="gmail_quote">On Sep 1, 2011 9:14 AM, &quot;Peter Dettman&quot; &lt;<a \
href="mailto:pkd@lockboxlabs.com">pkd@lockboxlabs.com</a>&gt; wrote:<br \
type="attribution">&gt; Great. So just call getEncoded() on the private key, which \
with the BC <br> &gt; provider will produce a PKCS#8 encoding (check getFormat() if \
using <br>&gt; another provider to make sure). Pass the resulting byte[] to <br>&gt; \
org.bouncycastle.crypto.util.PrivateKeyFactory.createKey and it should <br> &gt; \
return you an AsymmetricKeyParameter.<br>&gt; <br>&gt; <br>&gt; On 1/09/2011 7:42 PM, \
Lili Shi wrote:<br>&gt;&gt;<br>&gt;&gt; My private key is stored in the \
bks.<br>&gt;&gt;<br>&gt;&gt; On Sep 1, 2011 8:39 AM, &quot;Peter Dettman&quot; &lt;<a \
href="mailto:pkd@lockboxlabs.com">pkd@lockboxlabs.com</a> <br> &gt;&gt; &lt;mailto:<a \
href="mailto:pkd@lockboxlabs.com">pkd@lockboxlabs.com</a>&gt;&gt; wrote:<br>&gt;&gt; \
&gt; The AsymmetricKeyParameter has to be the private key corresponding \
to<br>&gt;&gt; &gt; your certificate.<br> &gt;&gt; &gt; How to create the appropriate \
object will depend on what format you <br>&gt;&gt; have<br>&gt;&gt; &gt; the private \
key available in. So, where is your private key coming from?<br>&gt;&gt; \
&gt;<br>&gt;&gt; &gt; Cheers,<br> &gt;&gt; &gt; Pete.<br>&gt;&gt; &gt;<br>&gt;&gt; \
&gt;<br>&gt;&gt; &gt; On 1/09/2011 7:29 PM, <a \
href="mailto:LilidotShi@gmail.com">LilidotShi@gmail.com</a> <br>&gt;&gt; \
&lt;mailto:<a href="mailto:LilidotShi@gmail.com">LilidotShi@gmail.com</a>&gt; \
wrote:<br> &gt;&gt; &gt;&gt; Thanks so much for your help Pete!<br>&gt;&gt; \
&gt;&gt;<br>&gt;&gt; &gt;&gt; I think I&#39;m starting to get the hang of this but I \
have one more<br>&gt;&gt; &gt;&gt; question. Creating an instance of \
DefaultTlsSignerCredentials means<br> &gt;&gt; &gt;&gt; supplying it with a \
TLscontext, a clientcert and an<br>&gt;&gt; &gt;&gt; AsymmetricKeyParameters. I can \
get the first two, TlsContext, like you<br>&gt;&gt; &gt;&gt; said is created for me, \
clientCert I got by converting the certificate<br> &gt;&gt; &gt;&gt; but how do I \
create/access AsymmetricKeyParameters, particularly if I<br>&gt;&gt; &gt;&gt; know \
it&#39;s going to be an instance of elliptic curve parameters?<br>&gt;&gt; \
&gt;&gt;<br>&gt;&gt; &gt;&gt; Again, sorry to bombard you with all these questions \
but I think once<br> &gt;&gt; &gt;&gt; I get past this I should be able to make a \
successful handshake.<br>&gt;&gt; &gt;&gt;<br>&gt;&gt; &gt;&gt; Lili<br>&gt;&gt; \
&gt;<br>&gt;&gt; &gt;<br>&gt; <br></div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic