On Wednesday, 4 March 2015 00:43:49 UTC+1, Jeffrey Walton wrote:
>
> >> However how do I construct points q and g)
> >>
> > You should be given G. Its the generator, and its part of the domain 
> parameters.
> ?
> > x is the private exponent, and Q is the public key. To generate `x`, you
> > pick a random number in [1, p-1] (IIRC). To get Q, you perform Q = xG 
> (IIRC).
>
> It just occurred to me what you may have been asking....
>
> Use the Initialize() that takes a PRNG. The library will generate x and Q 
> for you.
>
> If you use the Initialize() that lacks the PRNG, then you have to supply x 
> and Q.
>
>
Thanks Jeffrey

I believe the PEM pack s fine, its the .Load function that is throwing the 
BERDecode error. I have tried the following all resulting in BERDecode 
error on load (experimenting SHA1,SHA224,SHA256 Weak::MD5 etc)
ECDSA<ECP, CryptoPP::SHA>::PublicKey publicKeyDER;

    FileSource fs( "my-der.der", true /*pump all*/ );
    publicKeyDER.Load( fs );
    RandomNumberGenerator prng;
    valid = publicKeyDER.Validate( prng, 3 );

Here is the ASN output. 

openssl asn1parse -in my-der.der -inform DER -dlimit 16
    0:d=0  hl=2 l= 107 cons: SEQUENCE          
    2:d=1  hl=2 l=  87 cons: SEQUENCE          
    4:d=2  hl=2 l=   7 prim: OBJECT            :id-ecPublicKey
   13:d=2  hl=2 l=  76 cons: SEQUENCE          
   15:d=3  hl=2 l=   1 prim: INTEGER           :01
   18:d=3  hl=2 l=  26 cons: SEQUENCE          
   20:d=4  hl=2 l=   7 prim: OBJECT            :prime-field
   29:d=4  hl=2 l=  15 prim: INTEGER           :FFFFFFFFFFFFFFFFFFFFFFFFFDE7
   46:d=3  hl=2 l=   6 cons: SEQUENCE          
   48:d=4  hl=2 l=   1 prim: OCTET STRING      
      0001 - <SPACES/NULS>
   51:d=4  hl=2 l=   1 prim: OCTET STRING      
      0000 - 03                                                .
   54:d=3  hl=2 l=  15 prim: OCTET STRING      
      0000 - 02 00 00 00 00 00 00 00-00 00 00 00 00 00 01     
 ...............
   71:d=3  hl=2 l=  15 prim: INTEGER           
:0100000000000001ECEA551AD837E9
   88:d=3  hl=2 l=   1 prim: INTEGER           :01
   91:d=1  hl=2 l=  16 prim: BIT STRING        
      0000 - 00 02 XX XX XX XX XX XX-XX XX XX XX XX XX XX XX   
........L......[

and also:

Private-Key: (113 bit)
pub: 
    02:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx
Field Type: prime-field
Prime:
    00:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:fd:e7
A:    0
B:    3 (0x3)
Generator (compressed):
    02:00:00:00:00:00:00:00:00:00:00:00:00:00:01
Order: 
    01:00:00:00:00:00:00:01:ec:ea:55:1a:d8:37:e9
Cofactor:  1 (0x1)

-- 
-- 
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to [email protected].
More information about Crypto++ and this group is available at 
http://www.cryptopp.com.
--- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to