On Mon, Mar 13, 2006 at 03:42:53PM -0600, Allen Bierbaum wrote:
> On 3/13/06, Vadym Fedyukovych <[EMAIL PROTECTED]> wrote:
> > On Mon, Mar 13, 2006 at 01:34:54PM -0600, Allen Bierbaum wrote:
> > > On 3/13/06, Vadym Fedyukovych <[EMAIL PROTECTED]> wrote:
> > > > On Mon, Mar 13, 2006 at 10:34:05AM -0600, Allen Bierbaum wrote:
> > > > ...
> > > > > There are references on this list and elsewhere to key sizes around
> > > > > 128-150 bits in length.
> > > >
> > > > Field element representation could be around 130-190 bit size.
> > > > This is not exactly a signature or a public key.
> > >
> > > Maybe I should be more clear about what I need.
> > >
> > > What I want is to create a minimal data structure that could be used
> > > on a remote node to initialize the cryptopp representation of the
> > > public key.  I do not need to use any formal representation that would
> > > allow the key to be shared with other software.  I just need a way to
> > > represent the parameters that could be used by cryptopp to create the
> > > same key on another machine.  I can guarantee that the other node will
> > > be running the same version of crypto and will be using the same field
> > > parameters (??) namely ASN1::sect113r1().
> > >
> > > >From what I understand of EC I think I probably just need a way to
> > > share a curve point and possibly some other parameters.
> >
> > Yes, just a point should be enough, with group parameters hard-coded into 
> > application.
> 
> What I don't know is how to get "just a point" using the cryptopp API.
>  Can anyone point me at some code or tell me the exact API parameter
> that I need to store?

why not

  DL_GroupParameters_EC<EC2N> params(ASN1::sect113r1());
  ECIES<EC2N>::Decryptor priv(rng, params);
  ECIES<EC2N>::Encryptor pub(priv);

  pub.AccessKey().AccessGroupParameters().SetEncodeAsOID(true);
  pub.AccessKey().AccessGroupParameters().SetPointCompression(true);
  pub.GetKey().DEREncode(afile);

this gives me 39 bytes the whole structure and 17 for the point in the bitstring

openssl asn1parse -i -inform der -in /tmp/key.der
    0:d=0  hl=2 l=  37 cons: SEQUENCE
    2:d=1  hl=2 l=  16 cons:  SEQUENCE
    4:d=2  hl=2 l=   7 prim:   OBJECT            :id-ecPublicKey
   13:d=2  hl=2 l=   5 prim:   OBJECT            :1.3.132.0.4
   20:d=1  hl=2 l=  17 prim:  BIT STRING

> 
> Thanks,
> Allen

Reply via email to