forked from ibmruntimes/node-zcrypto
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.js
More file actions
43 lines (35 loc) · 981 Bytes
/
client.js
File metadata and controls
43 lines (35 loc) · 981 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
* Licensed Materials - Property of IBM
* (C) Copyright IBM Corp. 2020. All Rights Reserved.
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
const zcrypto = require('./');
const fs = require('fs')
var crypt;
function readKeysFromRACFKeyring() {
crypt = new zcrypto.ZCrypto();
// Racf Keyring
var rc = crypt.openKeyRing("TMYRING1");
if (rc) {
console.log(crypt.getErrorString(rc));
return;
}
var pem = zcrypto.exportCertToPEM(crypt, "TCACert1");
return pem;
}
var pem = readKeysFromRACFKeyring();
// Load modules that we'll use.
const https = require('https'); // HTTPS web server.
var options = {
hostname: 'hostname',
port: 3000,
path: '/',
method: 'GET',
ca: pem
};
var req = https.request(options, function(res) {
res.on('data', function(data) {
process.stdout.write(data);
});
});
req.end();