1
0
Fork 0
forked from svrjs/svrjs
This repository has been archived on 2024-11-10. You can view files and clone it, but cannot push or open issues or pull requests.
svrjs/node_modules/ocsp/test/server-test.js
2023-07-29 20:33:28 +02:00

48 lines
1 KiB
JavaScript

var ocsp = require('../');
var fixtures = require('./fixtures');
var assert = require('assert');
describe('OCSP Server', function() {
var issuer = fixtures.certs.issuer;
var good = fixtures.certs.good;
var revoked = fixtures.certs.revoked;
it('should provide ocsp response to the client', function(cb) {
var server = ocsp.Server.create({
cert: issuer.cert,
key: issuer.key
});
server.addCert(43, 'good');
server.addCert(44, 'revoked', {
revocationTime: new Date(),
revocationReason: 'cACompromise'
});
server.listen(8000, function() {
ocsp.check({
cert: good.cert,
issuer: issuer.cert
}, function(err, res) {
if (err)
throw err;
assert.equal(res.type, 'good');
next();
});
});
function next() {
ocsp.check({
cert: revoked.cert,
issuer: issuer.cert
}, function(err, res) {
assert(err);
assert.equal(res.type, 'revoked');
cb();
});
}
});
});