-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #71 from awlayton/fix-begin-public-rsa
Fix verify for RSAPublicKey formated keys
- Loading branch information
Showing
3 changed files
with
26 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
-----BEGIN RSA PUBLIC KEY----- | ||
MIIBCgKCAQEAvzoCEC2rpSpJQaWZbUmlsDNwp83Jr4fi6KmBWIwnj1MZ6CUQ7rBa | ||
suLI8AcfX5/10scSfQNCsTLV2tMKQaHuvyrVfwY0dINk+nkqB74QcT2oCCH9XduJ | ||
jDuwWA4xLqAKuF96FsIes52opEM50W7/W7DZCKXkC8fFPFj6QF5ZzApDw2Qsu3yM | ||
Rmr7/W9uWeaTwfPx24YdY7Ah+fdLy3KN40vXv9c4xiSafVvnx9BwYL7H1Q8NiK9L | ||
GEN6+JSWfgckQCs6UUBOXSZdreNN9zbQCwyzee7bOJqXUDAuLcFARzPw1EsZAyjV | ||
tGCKIQ0/btqK+jFunT2NBC8RItanDZpptQIDAQAB | ||
-----END RSA PUBLIC KEY----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
var jwt = require('../'); | ||
|
||
describe('public key start with BEGIN RSA PUBLIC KEY', function () { | ||
|
||
it('should work', function (done) { | ||
var fs = require('fs'); | ||
var cert_pub = fs.readFileSync(__dirname + '/rsa-public-key.pem'); | ||
var cert_priv = fs.readFileSync(__dirname + '/rsa-private.pem'); | ||
|
||
var token = jwt.sign({ foo: 'bar' }, cert_priv, { algorithm: 'RS256'}); | ||
|
||
jwt.verify(token, cert_pub, done); | ||
}); | ||
|
||
}); |