项目作者: litert

项目描述 :
A TLS SNI(Server Name Indication) library for Node.js.
高级语言: TypeScript
项目地址: git://github.com/litert/tls-sni.js.git
创建时间: 2019-01-27T15:53:27Z
项目社区:https://github.com/litert/tls-sni.js

开源协议:Apache License 2.0

下载


LiteRT/TLS-SNI

@litert/tls-sni" title="Stable Version">npm version
License
node
GitHub issues
GitHub Releases

A TLS SNI(Server Name Indication) library for Node.js.

Features

  • TypeScript Supports.
  • X.509 Certificate Decoder
  • Partial DER Decoder
  • Certificate Manager
  • Graceful Update Certificate.
  • RSA Certificate Supports.
  • RSA Key Pair Supports.
  • EC Certificate Supports.
  • EC Key Pair Supports.

Requirement

  • TypeScript v3.2.x (or newer)
  • Node.js v10.0.0 (or newer)

Installation

  1. npm i @litert/tls-sni --save

Usage

  1. import * as libsni from "@litert/tls-sni";
  2. import * as TLS from "tls";
  3. import * as FS from "fs";
  4. // 1. Create a certificate mananger object.
  5. const cm = libsni.certs.createManager();
  6. // 2. Load a certificate into certificate mananger
  7. cm.use(
  8. "default",
  9. FS.readFileSync(`./certs/default/cert-20190801.pem`),
  10. FS.readFileSync(`./certs/default/key-20190801.pem`)
  11. );
  12. // 3. Create a TLS server with the SNI callback provided by ceritificate manager.
  13. const server = TLS.createServer({
  14. SNICallback: cm.getSNICallback(),
  15. ...otherOptions
  16. });
  17. // ...
  18. // 4. Check if there are some certificates outdating.
  19. const outdatingCerts = cm.findExpiringCertificates(
  20. Date.now() + 28 * 86400000 // Optional, 7 days by default
  21. ); // Get the list of certificate names, which are outdating in 28 days.
  22. // ...
  23. // 5. When a cert is being outdated, replace it with a new one.
  24. cm.use(
  25. "default",
  26. FS.readFileSync(`./certs/default/cert-20190901.pem`),
  27. FS.readFileSync(`./certs/default/key-20190901.pem`)
  28. );

More usage, see examples.

Document

Preparing yet.

License

This library is published under Apache-2.0 license.