mirror of
https://github.com/Ylianst/MeshCommander
synced 2025-12-05 21:53:19 +00:00
- Updated cipher suites to include modern algorithms with SHA-256 and SHA-384 support. - Implemented Diffie-Hellman Ephemeral (DHE) and Elliptic Curve Diffie-Hellman (ECDH) key exchange methods. - Added HMAC-SHA256 and HMAC-SHA384 for message authentication. - Improved TLS handshake process to accommodate new key exchange algorithms. This update strengthens the security of the TLS implementation and aligns with current best practices.
95 lines
1.9 KiB
JavaScript
95 lines
1.9 KiB
JavaScript
/**
|
|
* Node.js module for Forge.
|
|
*
|
|
* @author Dave Longley
|
|
*
|
|
* Copyright 2011-2014 Digital Bazaar, Inc.
|
|
*/
|
|
(function() {
|
|
var name = 'forge';
|
|
if(typeof define !== 'function') {
|
|
// NodeJS -> AMD
|
|
if(typeof module === 'object' && module.exports) {
|
|
var nodeJS = true;
|
|
define = function(ids, factory) {
|
|
factory(require, module);
|
|
};
|
|
} else {
|
|
// <script>
|
|
if(typeof forge === 'undefined') {
|
|
// set to true to disable native code if even it's available
|
|
forge = {disableNativeCode: false};
|
|
}
|
|
return;
|
|
}
|
|
}
|
|
// AMD
|
|
var deps;
|
|
var defineFunc = function(require, module) {
|
|
module.exports = function(forge) {
|
|
var mods = deps.map(function(dep) {
|
|
return require(dep);
|
|
});
|
|
// handle circular dependencies
|
|
forge = forge || {};
|
|
forge.defined = forge.defined || {};
|
|
if(forge.defined[name]) {
|
|
return forge[name];
|
|
}
|
|
forge.defined[name] = true;
|
|
for(var i = 0; i < mods.length; ++i) {
|
|
mods[i](forge);
|
|
}
|
|
return forge;
|
|
};
|
|
// set to true to disable native code if even it's available
|
|
module.exports.disableNativeCode = false;
|
|
module.exports(module.exports);
|
|
};
|
|
var tmpDefine = define;
|
|
define = function(ids, factory) {
|
|
deps = (typeof ids === 'string') ? factory.slice(2) : ids.slice(2);
|
|
if(nodeJS) {
|
|
delete define;
|
|
return tmpDefine.apply(null, Array.prototype.slice.call(arguments, 0));
|
|
}
|
|
define = tmpDefine;
|
|
return define.apply(null, Array.prototype.slice.call(arguments, 0));
|
|
};
|
|
define([
|
|
'require',
|
|
'module',
|
|
'./aes',
|
|
'./aesCipherSuites',
|
|
'./asn1',
|
|
'./cipher',
|
|
'./cipherModes',
|
|
'./debug',
|
|
'./des',
|
|
'./dhe',
|
|
'./ecdh',
|
|
'./hmac',
|
|
'./kem',
|
|
'./log',
|
|
'./md',
|
|
'./mgf1',
|
|
'./pbkdf2',
|
|
'./pem',
|
|
'./pkcs7',
|
|
'./pkcs1',
|
|
'./pkcs12',
|
|
'./pki',
|
|
'./prime',
|
|
'./prng',
|
|
'./pss',
|
|
'./random',
|
|
'./rc2',
|
|
'./ssh',
|
|
'./task',
|
|
'./tls',
|
|
'./util'
|
|
], function() {
|
|
defineFunc.apply(null, Array.prototype.slice.call(arguments, 0));
|
|
});
|
|
})();
|