Hi Niklas,

I've tried that in my example... and it does appear to parse the public keys, 
as I get a list of 1 key, but passing the key (or key list) that to 
openpgp_msg_message.validateSignature(pubkey) fails.

see: https://gist.github.com/3036199 for full source

        var messages = openpgp.read_message(msg);
        var success = messages[0].verifySignature();
        print("using keyring: "+success);

        var keys = openpgp.read_publicKey(pubKey);
        success = messages[0].verifySignature(keys[0]);
        print("using passed key object: "+success);

        success = messages[0].verifySignature(keys);
        print("using passed key list: "+success);


output: 

        jklo$ js spidermonkey-test.js 
        using keyring: true
        using passed key object: false
        openpgp.js:12749: TypeError: key.obj is undefined

here's what's at openpgp.js:12748-12749

return openpgp_crypto_verifySignature(this.publicKeyAlgorithm, 
this.hashAlgorithm, 
                                        this.MPIs, 
key.obj.publicKeyPacket.MPIs, data+this.signatureData+trailer);

Thanks,

- Jim

Jim Klo
Senior Software Engineer
Center for Software Engineering
SRI International

On Jul 2, 2012, at 5:18 PM, Niklas wrote:

> Try reading keys using openpgp.read_publicKey(text) instead of the keyring. 
> 
> On 7/3/12 6:59 AM, Jim Klo wrote:
>> I seem to have to use the keys stored in the keyring, which is extra 
>> overhead that I'd like to avoid since my keyring can't really be modified in 
>> my use case.
>> 
> Try reading keys using openpgp.read_publicKey(text) instead.
> 
> 
> Most of this stuff seems to derive more or less directly from GPG4Browsers, I 
> recommend using their dev docs as a reference. 
> http://gpg4browsers.recurity.com/GPG4Browsers-Developer_Documentation.pdf

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

http://openpgpjs.org

Reply via email to