Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Webinos PZP moved to a separate repository
-includes wrt folder to include webinos and webinos.session -includes new code to create certificates -webinos_pzp to start pzp -this can currently start a PZP but not stable enough
- Loading branch information
1 parent
078b21b
commit 6f32baf
Showing
109 changed files
with
8,499 additions
and
2,544 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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"ports": { | ||
"provider": 80, | ||
"provider_webServer": 443, | ||
"pzp_webSocket": 8080, | ||
"pzp_tlsServer": 8040, | ||
"pzp_zeroConf": 4321, | ||
"iot": 3000 | ||
}, | ||
"pzpDefaultServices": [ | ||
{ | ||
"name": "test", | ||
"params": { | ||
"num": "21" | ||
} | ||
} | ||
], | ||
"friendlyName": "", | ||
"webinos_version": { | ||
"tag": "v0.8.0", | ||
"num_commit": "134", | ||
"commit_id": "gd62f210" | ||
} | ||
} |
File renamed without changes.
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,44 @@ | ||
var mandatoryModule = ["webinos-utilities", | ||
"webinos-certificateHandler", | ||
"webinos-messaging", | ||
"webinos-jsonrpc2", | ||
"webinos-api-serviceDiscovery", | ||
"webinos-api-test", | ||
"webinos-messaging" | ||
]; | ||
var optionalModule = ["webinos-synchronization", | ||
"webinos-policy" | ||
]; | ||
mandatoryModule.forEach(function(name) { | ||
if (!require.resolve(name)) { | ||
throw new Error("Webinos PZP mandatory module "+ name + " is missing, these modules are compulsory for PZP to run. " + | ||
"Please run npm install "+name+" at command prompt to proceed"); | ||
} | ||
}); | ||
optionalModule.forEach(function(name) { | ||
if (!require.resolve(name)) { | ||
console.log("Webinos PZP optional module "+ name + " is missing, PZP will run but functionality provided by "+ | ||
name + " will be missing"); | ||
} | ||
}); | ||
module.exports = { | ||
"wUtil" : require("webinos-utilities"), | ||
"wCertificate": require("webinos-certificateHandler"), | ||
"discovery" : require("webinos-api-serviceDiscovery").Service, | ||
"messageHandler": require("webinos-messaging").MessageHandler, | ||
"rpc" : require("webinos-jsonrpc2"), | ||
"session" : require("./pzp_sessionHandling"), | ||
"PzpDiscovery": require ("./pzp_peerDiscovery"), | ||
"PzpSib" : require("./pzp_SIB_auth"), | ||
"certExchange": require("./pzp_peerCertificateExchange.js"), | ||
"os" : require("os"), | ||
"https" : require('https'), | ||
"http" : require ("http"), | ||
"path" : require("path"), | ||
"fs" : require("fs"), | ||
"tls" : require("tls"), | ||
"url" : require("url"), | ||
"WebSocketServer":require ("websocket").server, | ||
"mandatoryModule":mandatoryModule | ||
|
||
}; |
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,96 @@ | ||
/******************************************************************************* | ||
* Code contributed to the webinos project | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* Copyright 2012 - 2013 Samsung Electronics (UK) Ltd | ||
* AUTHORS: Ziran Sun (ziran.sun@samsung.com) | ||
*******************************************************************************/ | ||
function PzpSIBAuth(PzpInstance) { | ||
"use strict"; | ||
var PzpCommon = require("./pzp.js"); | ||
var logger = PzpCommon.wUtil.webinosLogging(__filename) || console; | ||
/** | ||
* Create QR image using public key Hash | ||
* @param infile. Path for the public key certificate | ||
* @param outfile. Path for the generate QR image file (Android only) | ||
* @param width. Width of QR image to be generated (Android only) | ||
* @param height. Height of QR image to be generated (Android only) | ||
* @param cb. Callback when QR image generated | ||
*/ | ||
this.createQRHash = function(infile, outfile, width, height, cb) { | ||
PzpInstance.getKeyHash(infile, function(status, value){ | ||
if(status) { | ||
logger.log("get hash: " + value); | ||
if(PzpCommon.os.platform().toLowerCase() == "android") { | ||
try { | ||
var bridge = require('bridge'); | ||
var QRencode = bridge.load('org.webinos.impl.QRImpl', this); | ||
QRencode.enCode(value, width, height, outfile, function(outfile){ | ||
cb(outfile); | ||
}); | ||
} | ||
catch(e) { | ||
logger.error("Android QRencode - error: "+e.message); | ||
} | ||
} | ||
else | ||
{ | ||
try { | ||
var QRCode = require("qrcode"); | ||
QRCode.toDataURL(value, function(err, value) { | ||
logger.log("created url: " + value); | ||
cb(err, value); | ||
}); | ||
} catch (err) { | ||
logger.log("create QR failed: " + err); | ||
} | ||
} | ||
} | ||
else | ||
logger.log("get hash err: " + value); | ||
}); | ||
}; | ||
|
||
/** | ||
* Compare hash from the scanned QR code with Hash stored locally | ||
* @param filepath. path for other party's public key certificate | ||
* @param hash. Locally stored hash code | ||
* @param cb. Callback when comprison is done | ||
*/ | ||
this.checkQRHash = function(filename, hash, cb) { | ||
PzpInstance.getKeyHash(filename, function(status, value){ | ||
if(status) | ||
{ | ||
logger.log("hash passed over is: " + hash); | ||
logger.log("get hash of the other party: " + value) | ||
if(hash == value){ | ||
logger.log("correct hash key"); | ||
cb(true); | ||
} | ||
else | ||
{ | ||
logger.log("Wrong Hash Key"); | ||
cb(false); | ||
} | ||
} | ||
else | ||
{ | ||
logger.log("get hash err: " + value); | ||
} | ||
}); | ||
}; | ||
}; | ||
|
||
module.exports = PzpSIBAuth; | ||
|
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
Oops, something went wrong.