2.1.2 • Published 6 years ago
ssl-self-signed v2.1.2
ssl-self-signed 2.0.1
Generate 100-year self-signed ssl certificates for your domain/IP.
Requested
Install
npm install ssl-self-signed
Examples
var sss = require('ssl-self-signed');
// auto generate CA
sss({
output: __dirname,
commonName: '192.168.56.101',
end(){
if(err){
return console.error(err);
}
console.log('ok');
}
});Generate files:
CA.keyCA's private key.CA.crtImport into browser.server.crt和server.keyuse for server.
opts
CAIf not set(undefined): If under the ouput not haveCA.keyandCA.crt, It will generate CA. otherwise It will useCA.keyandCA.crtunder the ouput. defaultundefined.If is Object: It will use you provide'CA,
keyCA's private key path.certCA's cert file path.
bit: default2048days: default365 * 100C: Country default"CN"O: Organization default"AAA ssl-self-signed"
Use other CA:
var sss = require('ssl-self-signed');
sss({
output: __dirname,
commonName: '192.168.56.101',
CA: {
key: '/somePath/CA.key', //cmd path is output
cert: '/somePath/CA.crt'
},
C: 'CN', // Must be the same as CA, otherwise will be get a unhandle error.
O: 'AAA', // Must be the same as CA, otherwise will be get a unhandle error.
end(err){
if(err){
return console.error(err);
}
console.log('ok');
}
});Demo:
- Download CA-of-demo.crt
- Import into browsers(put it into 'Trusted Root Certification Authorities' place). Some guide like: window-chrome-import-guide
- Restart your browser.
- Visit https://149.129.62.26:3002