项目作者: linux-remote

项目描述 :
Generate self-signed ssl certificates for your domain/IP.
高级语言: JavaScript
项目地址: git://github.com/linux-remote/ssl-self-signed.git
创建时间: 2017-05-18T11:11:38Z
项目社区:https://github.com/linux-remote/ssl-self-signed

开源协议:MIT License

下载


ssl-self-signed

Generate 100-year self-signed ssl certificates for your domain/IP.

Requested

Linux

OpenSSL

Install

npm install ssl-self-signed

Examples

  1. var sss = require('ssl-self-signed');
  2. // auto generate CA
  3. sss({
  4. output: __dirname,
  5. commonName: '192.168.56.101',
  6. end(){
  7. if(err){
  8. return console.error(err);
  9. }
  10. console.log('ok');
  11. }
  12. });

Generate files:

  • CA.key CA’s private key.
  • CA.crt Import into browser.
  • server.crtserver.key use for server.

    opts

  • CA If not set(undefined): If under the ouput not have CA.key and CA.crt, It will generate CA. otherwise It will use CA.key and CA.crt under the ouput. default undefined.

    If is Object: It will use you provide’CA,

    • key CA’s private key path.
    • cert CA’s cert file path.
  • bit: default 2048
  • days: default 365 * 100
  • C: Country default "CN"
  • O: Organization default "AAA ssl-self-signed"

Use other CA:

  1. var sss = require('ssl-self-signed');
  2. sss({
  3. output: __dirname,
  4. commonName: '192.168.56.101',
  5. CA: {
  6. key: '/somePath/CA.key', //cmd path is output
  7. cert: '/somePath/CA.crt'
  8. },
  9. C: 'CN', // Must be the same as CA, otherwise will be get a unhandle error.
  10. O: 'AAA', // Must be the same as CA, otherwise will be get a unhandle error.
  11. end(err){
  12. if(err){
  13. return console.error(err);
  14. }
  15. console.log('ok');
  16. }
  17. });

Import CA:

Import CA.crt into browsers(should put it into ‘Trusted Root Certification Authorities’ place). Some guide like: window-chrome-import-guide

Also need restart your browser.