Comments (1)
Just copy the code from https://github.com/indutny/ocsp#cache. I've copiedpasted it below with some comments.
const https = require('https');
const ocsp = require('ocsp');
// Create cache for OCSP (it'll be used to respond to OCSP stapling requests)
var cache = new ocsp.Cache();
// Create your HTTPS server
var server = https.createServer({
cert: cert, // Your cert
key: key // Your private key
}, function(req, res) {
res.end('hello world'); // Your request handling and response
});
/*
* This block below responds to OCSP sapling requests
* 1. It gets OCSP URI for your certificate
* 2. Checks if there is a valid cached response
* 3. Sends cached response OR queries OCSP server (using OCSP URI) to get a response
*/
server.on('OCSPRequest', function(cert, issuer, cb) {
ocsp.getOCSPURI(cert, function(err, uri) {
if (err) return cb(err);
if (uri === null) return cb();
var req = ocsp.request.generate(cert, issuer);
cache.probe(req.id, function(err, cached) {
if (err) return cb(err);
if (cached !== false) return cb(null, cached.response);
var options = {
url: uri,
ocsp: req.data
};
cache.request(req.id, options, cb);
});
});
});
from ocsp.
Related Issues (20)
- Cannot read property _getEncoder of undefined when parsing staging letsencrypt certs HOT 8
- Verification failure on many popular sites HOT 3
- Question: Is there an event to tell whether an OCSP request was fulfilled via cache vs sent to the CA?
- Test failing in .check() HOT 4
- Is posible to use a database instead ocsp server add method ? HOT 1
- OCSP check failed against windows blob storage
- TimeoutOverflowWarning with large nextUpdate values
- [Question] Set response property 'revoked' = true instead of throwing error?
- No support for more advanced signing algorithms
- Cert and Nonce Missing from OCSP Response? HOT 4
- error from ocsp agent HOT 1
- Check() through a proxy?
- Bad decrypt. HOT 2
- OCSP cache doesnโt have a means of clearing all cache invalidation check intervals
- Tests failing
- Invalid signature leads to process termination HOT 1
- Bump version of asn1.js to avoid deprecated `new Buffer()` calls HOT 1
- ocsp.check() ends with 'Error: Invalid signature'
- How to enable ocsp in web socket
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ocsp.