> The following program reads and verifies the public key OK, but
> it dies on the private key. It needs the OID patch...
>
> Next is to figure out version 0 vs 1.
Here's the code you need to use to call to decode the private key.
BERDecodePrivateKey routes to DL_PrivateKey_EC<EC>::BERDecodePrivateKey,
and not PKCS8PrivateKey::BERDecode.
cout << "Loading verifier key..." << endl;
FileSource fs2("wtls8-pub.der", true);
verifier.AccessKey().BERDecode(fs2);
verifier.GetKey().Validate(prng, 3);
cout << "Validated verifier key..." << endl;
cout << "Loading signer key..." << endl;
FileSource fs1("wtls8-priv.der", true);
signer.AccessKey().BERDecodePrivateKey(fs1, false,
(size_t)fs1.MaxRetrievable());
signer.GetKey().Validate(prng, 3);
cout << "Validated signer key..." << endl;
AccessKey() returns a non-const reference; GetKey() returns a const
reference.
And you still need the OID patch.
Jeff
On Thursday, March 12, 2015 at 3:24:19 AM UTC-4, Jeffrey Walton wrote:
>
> I was able to produce a private and public keys with the following
> commands (thanks BJ):
>
> # Private key
> openssl ecparam -name wap-wsg-idm-ecid-wtls8 -genkey -noout \
> -out wtls8-priv.der -outform DER -conv_form compressed \
> -param_enc named_curve
>
> And:
>
> # Public key
> openssl ec -in wtls8-priv.der -inform DER -outform DER \
> -conv_form compressed -out wtls8-pub.der -pubout
>
> Note the use of `-param_enc named_curve`. The named curve is required per
> RFC 5915. "Named Curve" means you call it by the OID, and not a list of
> domain parameters.
>
> The following program reads and verifies the public key OK, but it dies on
> the private key. It needs the OID patch.
>
> cout << "Loading verifier key..." << endl;
> FileSource fs2("wtls8-pub.der", true);
> verifier.BERDecode(fs2);
>
> verifier.GetKey().Validate(prng, 3);
> cout << "Validated verifier key..." << endl;
>
> cout << "Loading signer key..." << endl;
> FileSource fs1("wtls8-priv.der", true);
> signer.BERDecode(fs1);
>
> signer.GetKey().Validate(prng, 3);
> cout << "Validated signer key..." << endl;
>
> It dies on parsing the private key in PKCS8PrivateKey::BERDecode due to
> the version check (more below).
>
> According to RFC 5915:
>
> ECPrivateKey ::= SEQUENCE {
> version INTEGER { ecPrivkeyVer1(1) } (ecPrivkeyVer1),
> privateKey OCTET STRING,
> parameters [0] ECParameters {{ NamedCurve }} OPTIONAL,
> publicKey [1] BIT STRING OPTIONAL
> }
>
>
> And:
>
> $ dumpasn1 wtls8-priv.der
> 0 62: SEQUENCE {
> 2 1: INTEGER 1
> 5 14: OCTET STRING FD 11 D7 5E E1 72 74 E0 A5 69 A2 6E 69 49
> 21 7: [0] {
> 23 5: OBJECT IDENTIFIER '2 23 43 1 4 8'
> : }
> 30 32: [1] {
> 32 30: BIT STRING
> : 04 68 0C BA 14 5D D1 FC C1 FE 8A 7E A0 4E 86 58
> : 6E 28 33 FE 2C EF EF 74 E7 ED 61 ED D0
> : }
> : }
>
> But Crypto++ wants version 0 (from asn.cpp:548):
>
> // check version
> BERDecodeUnsigned<word32>(privateKeyInfo, version, INTEGER, 0, 0);
>
> Next is to figure out version 0 vs 1.
>
> Jeff
>
> **********
> $ gdb ./wtls-test.exe
> ...
> **********
>
> On Thursday, February 26, 2015 at 8:54:45 AM UTC-5, Brendan Jones wrote:
>>
>> Hi all,
>>
>> I was wondering if anyone could tell me if it is in fact possible to
>> verify a signature created using WTLS-8?
>> A reference to the specification of this curve can be found here:
>> http://technical.openmobilealliance.org/tech/affiliates/wap/wap-261-wtls-20010406-a.pdf
>>
>> (page 90)
>>
>> We are currently looking at alternatives to OpenSSL and Crypto++ seems
>> like a good way to go.
>> I have spent a little time trying to do this in Crypto++ but I have not
>> had any success as yet. Before I go any further I thought I'd ask the
>> knowledgable folk here.
>>
>
--
--
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.