-
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Calvin Metcalf
committed
Nov 15, 2014
1 parent
342c74f
commit 130b1e2
Showing
11 changed files
with
130 additions
and
25 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,20 @@ | ||
exports['RSA-SHA224'] = exports.sha224WithRSAEncryption = { | ||
sign: 'rsa', | ||
hash: 'sha224' | ||
hash: 'sha224', | ||
id: new Buffer('302d300d06096086480165030402040500041c', 'hex') | ||
}; | ||
exports['RSA-SHA256'] = exports.sha256WithRSAEncryption = { | ||
sign: 'rsa', | ||
hash: 'sha256' | ||
hash: 'sha256', | ||
id: new Buffer('3031300d060960864801650304020105000420', 'hex') | ||
}; | ||
exports['RSA-SHA384'] = exports.sha384WithRSAEncryption = { | ||
sign: 'rsa', | ||
hash: 'sha384' | ||
hash: 'sha384', | ||
id: new Buffer('3041300d060960864801650304020205000430', 'hex') | ||
}; | ||
exports['RSA-SHA512'] = exports.sha512WithRSAEncryption = { | ||
sign: 'rsa', | ||
hash: 'sha512' | ||
}; | ||
hash: 'sha512', | ||
id: new Buffer('3051300d060960864801650304020305000440', 'hex') | ||
}; |
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
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
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,31 @@ | ||
var test = require('tape'); | ||
var fs = require('fs'); | ||
var priv1024 = fs.readFileSync(__dirname + '/rsa.1024.priv'); | ||
var pub1024 = fs.readFileSync(__dirname + '/rsa.1024.pub'); | ||
var priv2028 = fs.readFileSync(__dirname + '/rsa.2028.priv'); | ||
var pub2028 = fs.readFileSync(__dirname + '/rsa.2028.pub'); | ||
var nodeCrypto = require('crypto'); | ||
var myCrypto = require('../'); | ||
function testIt(pub, priv, message, scheme) { | ||
test(message.toString(), function (t) { | ||
t.plan(4); | ||
var mySign = myCrypto.createSign(scheme); | ||
var nodeSign = nodeCrypto.createSign(scheme); | ||
var mySig = mySign.update(message).sign(priv); | ||
var nodeSig = nodeSign.update(message).sign(priv); | ||
t.equals(mySig.length, nodeSig.length, 'correct length'); | ||
t.equals(mySig.toString('hex'), nodeSig.toString('hex'), 'equal sigs'); | ||
var myVer = myCrypto.createVerify(scheme); | ||
var nodeVer = nodeCrypto.createVerify(scheme); | ||
t.ok(nodeVer.update(message).verify(pub, mySig), 'test node'); | ||
t.ok(myVer.update(message).verify(pub, nodeSig), 'test me'); | ||
}); | ||
} | ||
testIt(pub1024, priv1024, new Buffer('sha224 with 1024 keys'), 'RSA-SHA224'); | ||
testIt(pub2028, priv2028, new Buffer('sha224 with 2028 keys'), 'RSA-SHA224'); | ||
testIt(pub1024, priv1024, new Buffer('SHA256 with 1024 keys'), 'RSA-SHA256'); | ||
testIt(pub2028, priv2028, new Buffer('SHA256 with 2028 keys'), 'RSA-SHA256'); | ||
testIt(pub1024, priv1024, new Buffer('SHA384 with 1024 keys'), 'RSA-SHA384'); | ||
testIt(pub2028, priv2028, new Buffer('SHA384 with 2028 keys'), 'RSA-SHA384'); | ||
testIt(pub1024, priv1024, new Buffer('SHA512 with 1024 keys'), 'RSA-SHA512'); | ||
testIt(pub2028, priv2028, new Buffer('SHA512 with 2028 keys'), 'RSA-SHA512'); |
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 @@ | ||
-----BEGIN RSA PRIVATE KEY----- | ||
MIICVAIBAAJ/OwswbFo/uyC8ltGf/yA1A+gV5IGdnAgPbUSI3GzbHCA+x+TLG/tL | ||
vbRw3r1smppY/jkkpiVW1ErSMuN0uixp5gb78Z9rH1XpWb5WWgp3WaY/9EHMjMdO | ||
kQ/9LVZvRvl/M/Fi6owP+q+amJI1BEjECYfbhGL3rmlVdq4qXc40QwIDAQABAn8I | ||
VZ0BPoAOhyF33KFMHxy8r28fsVgxJUYgM3NqQgdv4fFawCYXjhJz9duU5YJGFJGJ | ||
WUGeHlkyYFlpi4f3m7tY7JawmQUWB0MNSoKHI3cgDX4/tfBN8ni+cO0eSoR5czBY | ||
EsAHBU47p1awNFAHwd+ZEuv9H4RmMn7p279rQTtpAkAH3Nqs2/vrRF2cZUN4fIXf | ||
4xHsQBByUayGq8a3J0UGaSFWv68zTUKFherr9uZotNp7NJ4jBXiARw0q8docXUG1 | ||
AkAHgmOKHoORtAmikqpmFEJZOtsXMaLCIm4EszPo5ciYoLMBcVit09AdiQlt7ZJL | ||
DY02svU1b0agCZ97kDkmHDkXAkACa8M9JELuDs/P/vIGYDkMVatIFfW6bWF02eFG | ||
taWwMqCcSEsWvbw0xqYt34jURpNbCjmCyQVwYfAw/+TLhP9dAkAFwRjdwjw37qpj | ||
ddg1mNiu37b7swFxmkiMOXZRxaNNsfb56A14RpN3zob3QdGUybGodMIKTFbmU/lu | ||
CjqAxafJAkAG2yf6RWbwFIWfMyt7WYCh0VaGBCcgy574AinVieEo3ZZyFfC63+xm | ||
3uoaNy4iLoJv4GCjqUBz3ZfcVaO/DDWG | ||
-----END RSA PRIVATE 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,5 @@ | ||
-----BEGIN RSA PUBLIC KEY----- | ||
MIGGAn87CzBsWj+7ILyW0Z//IDUD6BXkgZ2cCA9tRIjcbNscID7H5Msb+0u9tHDe | ||
vWyamlj+OSSmJVbUStIy43S6LGnmBvvxn2sfVelZvlZaCndZpj/0QcyMx06RD/0t | ||
Vm9G+X8z8WLqjA/6r5qYkjUESMQJh9uEYveuaVV2ripdzjRDAgMBAAE= | ||
-----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,27 @@ | ||
-----BEGIN RSA PRIVATE KEY----- | ||
MIIEjwIBAAKB/gy7mjaWgPeFdVYDZWRCA9BNiv3pPb0es27+FKY0hszLaOw47ExC | ||
tAWpDsH48TXAfyHBYwBLguayfk4LGIupxb+CGMbRo3xEp0CbfY1Jby26T9vGjRC1 | ||
foHDDUJG84uaRbyHqaf4i6zt4gVR+xlAEIjkaFAAK8cOoXAT1CVqGLLljUCchL8P | ||
jaHj/yriZ/S7rdwlI3LnABxwwmLrmR/v71WtpmO/aNG8N+1po+QwaghTkyQ59E/Z | ||
vAuOkFWHok2q/R6PYAa2jdZ9zim0FqOP+nkQaEDRbBFBmBqTv5fFGfk2WsAfKf/R | ||
G0/VFd+ZeM5251TeTvXH695nlSGauVl9AgMBAAECgf4LrWHY/l54ouThZWvvbrug | ||
pfz6sJX2g9l7yXmWlEWsPECVo/7SUbpYFpt6OZy99zSg+IKbGqWKfdhoKrTwIVtC | ||
L0YZ0NlmdnANSIz0roxQG7ZxkL5+vHSw/PmD9x4Uwf+Cz8hATCmNBv1qc60dkyuW | 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0Dxgez4zcZu0P1olO0cN3KM | ||
nxJ0Pds3R8bAhNCDdS2JZaRp5Q== | ||
-----END RSA PRIVATE 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,8 @@ | ||
-----BEGIN RSA PUBLIC KEY----- | ||
MIIBBgKB/gy7mjaWgPeFdVYDZWRCA9BNiv3pPb0es27+FKY0hszLaOw47ExCtAWp | ||
DsH48TXAfyHBYwBLguayfk4LGIupxb+CGMbRo3xEp0CbfY1Jby26T9vGjRC1foHD | ||
DUJG84uaRbyHqaf4i6zt4gVR+xlAEIjkaFAAK8cOoXAT1CVqGLLljUCchL8PjaHj | ||
/yriZ/S7rdwlI3LnABxwwmLrmR/v71WtpmO/aNG8N+1po+QwaghTkyQ59E/ZvAuO | ||
kFWHok2q/R6PYAa2jdZ9zim0FqOP+nkQaEDRbBFBmBqTv5fFGfk2WsAfKf/RG0/V | ||
Fd+ZeM5251TeTvXH695nlSGauVl9AgMBAAE= | ||
-----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