Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

salmon: pass signature to provenance.verifyRSASHA256() base64url_decoded

  • Loading branch information...
commit dd92413a2b45ff8cf8584248657dfd279838aeee 1 parent db01904
@astro astro authored
View
2  lib/ostatus/salmon.js
@@ -180,7 +180,7 @@ function verifySignature(me, sig, pubKey) {
me.encoding || 'base64url',
me.alg || 'RSA-SHA256');
console.log('vM: '+m);
- return Provenance.verifyRSASHA256(m, sig,
+ return Provenance.verifyRSASHA256(m, base64url_decode(sig),
{ n: base64url_decode(match[1]),
e: base64url_decode(match[2])
});
View
8 src/provenance.cc
@@ -241,6 +241,10 @@ static Handle<Value> VerifyRSASHA256(const Arguments &args) {
Handle<Object> sig = args[1]->ToObject();
int sigLen = Buffer::Length(sig);
unsigned char *sigBuf = (unsigned char *)Buffer::Data(sig);
+ printf("sig(%i):", sigLen);
+ for(int i=0; i < sigLen;i++)
+ printf(" %02X",sigBuf[i]);
+ printf("\n");
Handle<Object> pubKey = args[2]->ToObject();
/* Prepare key */
@@ -259,10 +263,6 @@ static Handle<Value> VerifyRSASHA256(const Arguments &args) {
for(int i=0; i < rsigLen;i++)
printf(" %02X",rsigBuf[i]);
printf("\n");
- /*printf("sig(%i):", sigLen);
- for(int i=0; i < sigLen;i++)
- printf(" %02X",sigBuf[i]);
- printf("\n");*/
/* Compare to digest */
BIO *emsa = EMSA_PKCS1_v1_5(m, BN_num_bytes(rsa->n));
View
2  tests/test_salmon.js
@@ -19,7 +19,7 @@ Vows.describe('Salmon').addBatch({
},
'can be used to sign': {
topic: function() {
- this.me = { data: 'Hello World',
+ this.me = { data: Salmon.base64url_encode('Hello World'),
data_type: 'application/test' };
this.sig = Salmon.generateSignature(this.me, this.key.private);
this.callback();

0 comments on commit dd92413

Please sign in to comment.
Something went wrong with that request. Please try again.