Skip to content

Commit

Permalink
Merge pull request #1 from frankiethekneeman/feature/decryptVerifyArray
Browse files Browse the repository at this point in the history
Decrypt and Verify from an array of pertinent keys.
  • Loading branch information
frankiethekneeman committed Oct 26, 2015
2 parents b206dfb + 86e3fdd commit c655eb9
Show file tree
Hide file tree
Showing 35 changed files with 351 additions and 163 deletions.
4 changes: 2 additions & 2 deletions demo/consumerDemo.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
var ServerosConsumer = require('../src/classes/ServerosConsumer')
, fs = require('fs')
, fs = require('fs')
, request = require('request')
, Hawk = require('hawk')
, masterPublicKey = fs.readFileSync('./demo/keys/master.pem') + ''
, myPrivateKey = fs.readFileSync('./demo/keys/serverA')
, myPrivateKey = fs.readFileSync('./demo/keys/serverA')
, masterServerLocation
, consumer = new ServerosConsumer({
id: 'Application A'
Expand Down
51 changes: 51 additions & 0 deletions demo/keys/serverA2
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
-----BEGIN RSA PRIVATE KEY-----
MIIJJQIBAAKCAgEA33IdtD14XyW35w1gRqC8X3kpvCP8AAFea+emN18fswDKRrU5
rvmMqWk6lYbxJOHn0loifQPY2rhaN00t3zLzwtjYZWw3Xx08krltqQ1O+56bnBLf
+xKkqGkzsoMNKa7H2EFbcS8iJnEgH2XL/TFhEaHhNbVG9VwWJ49d/+z4SfPzmF+M
9YTt8p5l1eMg1K4BdNMTp3vpqZOL+2YufjMdISBXLUMT3miAkSf9eFj9UDjH+2JN
tgUcQxU7XKHr1/wtFqfI2sh9iIexOUJ30SheqqkWn2hwBYfL6qHi4RE5i6bA2Ssq
6FmrI3XB8ZtGOcFP+yzulKMTHQk4NxZipDAvkdBWWMOdoyWeq/cyHHoL6HFf7HZ3
Wqh20fTL98qjQ0k7ybcJ/8qFwY3pSL4TP86i+2bojErnKzcnB9bZVAkzvXCtWpC+
RaoCwiJa2XyDCIfc9L3qN4O4yiRg4sdCjo6kufSY8sn+ESV0iniSxUnUX0eYrEPE
rL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6sKDx9G8HjuImSSmfzlRNtVG7XmxuNTNXfDar0KSRbWNv/eG
fTCkIo1b3p/Vk2aM6IPcniFmttLslmoXNqEecNR4bbxMz55TfHLpvJoeW/1EKkHy
+q21rX7qzLUVyBskkHqN6OTlTfb7AoIBAHJoKdfC2kYgll1x9ibJJYU9yQYvEOI2
3+XLuyE0LrEYLXcsJSRpyQU+pazXH2COaiHCrL1k/kPRg/Q0KbE5AfuOm2X1i/ss
IRhuEQ3iwyFVylndShf93Snrx3dfV3qxxTNd9GSJUh2hwHlcIaHaVhAePVG1m05O
gpQpI/bB32dB7T6mFxqKoNf0ntRfzS1/W0xsGSXqTlLPhiBmFNMGHkFJ11HRwhCJ
pW4TEhIJXX5tfm/2ireBjYpC42QEOQPBC7Iwf+YNCknV6m8bwbWE3buQPK7u+Vlp
yXRzz+g4OOHXtl5egYnQ+Y9oSOeWDFNKitctfy89xKt0sHTCK+Bb+2k=
-----END RSA PRIVATE KEY-----
13 changes: 13 additions & 0 deletions demo/keys/serverA2.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
-----BEGIN RSA PUBLIC KEY-----
MIICCAKCAgEA33IdtD14XyW35w1gRqC8X3kpvCP8AAFea+emN18fswDKRrU5rvmM
qWk6lYbxJOHn0loifQPY2rhaN00t3zLzwtjYZWw3Xx08krltqQ1O+56bnBLf+xKk
qGkzsoMNKa7H2EFbcS8iJnEgH2XL/TFhEaHhNbVG9VwWJ49d/+z4SfPzmF+M9YTt
8p5l1eMg1K4BdNMTp3vpqZOL+2YufjMdISBXLUMT3miAkSf9eFj9UDjH+2JNtgUc
QxU7XKHr1/wtFqfI2sh9iIexOUJ30SheqqkWn2hwBYfL6qHi4RE5i6bA2Ssq6Fmr
I3XB8ZtGOcFP+yzulKMTHQk4NxZipDAvkdBWWMOdoyWeq/cyHHoL6HFf7HZ3Wqh2
0fTL98qjQ0k7ybcJ/8qFwY3pSL4TP86i+2bojErnKzcnB9bZVAkzvXCtWpC+RaoC
wiJa2XyDCIfc9L3qN4O4yiRg4sdCjo6kufSY8sn+ESV0iniSxUnUX0eYrEPErLjm
l+jVjutEsIlPEKwyg6IBZ/3jzKdy0Lq/7F0PdoZ1lk+D06o/y+IaIiIIP/zpTxny
fzEIIeOmXHTbOiyj138z8W9F/joZoCwGAT3Q2L2Hqva9C/Aq7iSZe4ULROz7BctC
0/zyK32WznJgTN8Hrs4sMuLPZo3Y79IQlk6wjTyfUd1mAPDerHi1P6sCASM=
-----END RSA PUBLIC KEY-----
14 changes: 14 additions & 0 deletions demo/keys/serverA2.pem8
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-----BEGIN PUBLIC KEY-----
MIICIDANBgkqhkiG9w0BAQEFAAOCAg0AMIICCAKCAgEA33IdtD14XyW35w1gRqC8
X3kpvCP8AAFea+emN18fswDKRrU5rvmMqWk6lYbxJOHn0loifQPY2rhaN00t3zLz
wtjYZWw3Xx08krltqQ1O+56bnBLf+xKkqGkzsoMNKa7H2EFbcS8iJnEgH2XL/TFh
EaHhNbVG9VwWJ49d/+z4SfPzmF+M9YTt8p5l1eMg1K4BdNMTp3vpqZOL+2YufjMd
ISBXLUMT3miAkSf9eFj9UDjH+2JNtgUcQxU7XKHr1/wtFqfI2sh9iIexOUJ30She
qqkWn2hwBYfL6qHi4RE5i6bA2Ssq6FmrI3XB8ZtGOcFP+yzulKMTHQk4NxZipDAv
kdBWWMOdoyWeq/cyHHoL6HFf7HZ3Wqh20fTL98qjQ0k7ybcJ/8qFwY3pSL4TP86i
+2bojErnKzcnB9bZVAkzvXCtWpC+RaoCwiJa2XyDCIfc9L3qN4O4yiRg4sdCjo6k
ufSY8sn+ESV0iniSxUnUX0eYrEPErLjml+jVjutEsIlPEKwyg6IBZ/3jzKdy0Lq/
7F0PdoZ1lk+D06o/y+IaIiIIP/zpTxnyfzEIIeOmXHTbOiyj138z8W9F/joZoCwG
AT3Q2L2Hqva9C/Aq7iSZe4ULROz7BctC0/zyK32WznJgTN8Hrs4sMuLPZo3Y79IQ
lk6wjTyfUd1mAPDerHi1P6sCASM=
-----END PUBLIC KEY-----
1 change: 1 addition & 0 deletions demo/keys/serverA2.pub
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAgEA33IdtD14XyW35w1gRqC8X3kpvCP8AAFea+emN18fswDKRrU5rvmMqWk6lYbxJOHn0loifQPY2rhaN00t3zLzwtjYZWw3Xx08krltqQ1O+56bnBLf+xKkqGkzsoMNKa7H2EFbcS8iJnEgH2XL/TFhEaHhNbVG9VwWJ49d/+z4SfPzmF+M9YTt8p5l1eMg1K4BdNMTp3vpqZOL+2YufjMdISBXLUMT3miAkSf9eFj9UDjH+2JNtgUcQxU7XKHr1/wtFqfI2sh9iIexOUJ30SheqqkWn2hwBYfL6qHi4RE5i6bA2Ssq6FmrI3XB8ZtGOcFP+yzulKMTHQk4NxZipDAvkdBWWMOdoyWeq/cyHHoL6HFf7HZ3Wqh20fTL98qjQ0k7ybcJ/8qFwY3pSL4TP86i+2bojErnKzcnB9bZVAkzvXCtWpC+RaoCwiJa2XyDCIfc9L3qN4O4yiRg4sdCjo6kufSY8sn+ESV0iniSxUnUX0eYrEPErLjml+jVjutEsIlPEKwyg6IBZ/3jzKdy0Lq/7F0PdoZ1lk+D06o/y+IaIiIIP/zpTxnyfzEIIeOmXHTbOiyj138z8W9F/joZoCwGAT3Q2L2Hqva9C/Aq7iSZe4ULROz7BctC0/zyK32WznJgTN8Hrs4sMuLPZo3Y79IQlk6wjTyfUd1mAPDerHi1P6s= [email protected]
14 changes: 9 additions & 5 deletions demo/masterDemo.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
var fs = require('fs')
var fs = require('fs')
, publicKeys = {
"Application A": fs.readFileSync('./demo/keys/serverA.pem') + ''
"Application A": [
fs.readFileSync('./demo/keys/serverA2.pem') + ''
, fs.readFileSync('./demo/keys/serverA.pem') + ''
]
, "Application B": fs.readFileSync('./demo/keys/serverB.pem') + ''
}
, myPrivateKey = fs.readFileSync('./demo/keys/master')
, myPrivateKey = fs.readFileSync('./demo/keys/master')
, notMyPrivateKey = fs.readFileSync('./demo/keys/serverA')
, keyFunction = function(id, requester, callback) {
process.nextTick(function() {
callback({
Expand All @@ -21,7 +25,7 @@ var fs = require('fs')

var express = require('express')
, master = new ServerosMaster({
privateKey: myPrivateKey
privateKey: [notMyPrivateKey, myPrivateKey]
, publicKeyFunction: keyFunction
, hashes: ['sha1', 'sha256', 'sha512']
, ciphers: ['aes128', 'aes256', 'aes192']
Expand All @@ -32,6 +36,6 @@ master.addAuthenticationEndpoint(application);
var server = application.listen(3500, 'localhost', function () {
var host = server.address().address;
var port = server.address().port;

console.log('Example app listening at http://%s:%s', host, port);
});
6 changes: 3 additions & 3 deletions demo/providerDemo.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ var ServerosServiceProvider = require('../src/classes/ServerosServiceProvider')
, HawkAuthenticator = require('../src/classes/HawkAuthenticator')
, Hawk = require('hawk')
, express = require('express')
, fs = require('fs')
, fs = require('fs')
, bodyParser = require('body-parser')
, masterPublicKey = fs.readFileSync('./demo/keys/master.pem') + ''
, myPrivateKey = fs.readFileSync('./demo/keys/serverB')
, myPrivateKey = fs.readFileSync('./demo/keys/serverB')
, application = express()
, provider = new ServerosServiceProvider({
id: 'Application B'
Expand All @@ -29,6 +29,6 @@ application.get('/test', function(req, res, next) {
var server = application.listen(3501, 'localhost', function () {
var host = server.address().address;
var port = server.address().port;

console.log('Example app listening at http://%s:%s', host, port);
});
8 changes: 4 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ module.exports = exports = {
/**
* {@link Serveros.ServerosMaster ServerosMaster}
*/
ServerosMaster : "./src/classes/ServerosMaster" ,
ServerosMaster : require("./src/classes/ServerosMaster") ,
/**
* {@link Serveros.ServerosServiceProvider ServerosServiceProvider}
*/
ServerosServiceProvider : "./src/classes/ServerosServiceProvider" ,
ServerosServiceProvider : require("./src/classes/ServerosServiceProvider") ,
/**
* {@link Serveros.ServerosConsumer ServerosConsumer}
*/
ServerosConsumer : "./src/classes/ServerosConsumer" ,
ServerosConsumer : require("./src/classes/ServerosConsumer") ,
/**
* {@link Plugins.HawkAuthenticator HawkAuthenticator}
*/
HawkAuthenticator : "./src/classes/HawkAuthenticator"
HawkAuthenticator : require("./src/classes/HawkAuthenticator")
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "serveros",
"version": "0.2.2",
"version": "0.2.3",
"description": "Auth for networks of applications.",
"repository": {
"type": "git",
Expand Down
Loading

0 comments on commit c655eb9

Please sign in to comment.