Skip to content

Commit

Permalink
use dedicated Cm
Browse files Browse the repository at this point in the history
  • Loading branch information
erossignon committed Jan 9, 2021
1 parent 7364c41 commit a3a1a75
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as path from "path";

import {
get_empty_nodeset_filename,
OPCUACertificateManager,
OPCUAClient,
OPCUAServer,
} from "node-opcua";
Expand All @@ -20,6 +21,7 @@ const empty_nodeset_filename = get_empty_nodeset_filename();

const certificateFolder = path.join(__dirname, "../../../node-opcua-samples/certificates");

const tmpFolder= path.join(__dirname,"../../tmp");
const port = 2231;

let server: OPCUAServer;
Expand All @@ -28,8 +30,27 @@ let endpointUrl: string;
// -outform der -out example.der -subj "/CN=example.com" -days 3650
async function startServer(): Promise<OPCUAServer> {


const serverCertificateManager= new OPCUACertificateManager({
rootFolder: path.join(tmpFolder,"serverPKI"+port),
automaticallyAcceptUnknownCertificate: false,
});
await serverCertificateManager.initialize();


const userCertificateManager= new OPCUACertificateManager({
rootFolder: path.join(tmpFolder,"userPKI"+port),
automaticallyAcceptUnknownCertificate: false,
});
await userCertificateManager.initialize();

server = new OPCUAServer({
userCertificateManager,

serverCertificateManager,

maxAllowedSessionNumber: 10,

nodeset_filename: empty_nodeset_filename,
port,
});
Expand Down Expand Up @@ -57,6 +78,7 @@ async function endServer() {
}
}


const describe = require("node-opcua-leak-detector").describeWithLeakDetector;
describe("Testing Session with user certificate", () => {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,8 @@ function check_open_secure_channel_fails(securityPolicy, securityMode, options,
if (err) {
debugLog("Error = ", err.message);
client.disconnect(function() {
console.log((new Date()).toUTCString());
dumpCertificate(client.certificateFile,(err,data) => { console.log(data)});
// xx console.log((new Date()).toUTCString());
// xx dumpCertificate(client.certificateFile,(err,data) => { console.log(data)});
done();
});

Expand Down

0 comments on commit a3a1a75

Please sign in to comment.