-
-
Notifications
You must be signed in to change notification settings - Fork 595
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
144 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Copyright 2014 ISRG. All rights reserved | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
// | ||
// To revoke a certificate against a local Boulder: | ||
// js revoke.js cert.pem key.pem | ||
|
||
'use strict'; | ||
|
||
var crypto = require('./crypto-util'); | ||
var util = require('./acme-util'); | ||
var forge = require('node-forge'); | ||
var fs = require('fs'); | ||
var request = require('request'); | ||
|
||
function main() { | ||
if (process.argv.length != 4) { | ||
console.log('Usage: js revoke.js cert.der key.pem'); | ||
process.exit(1); | ||
} | ||
var key = crypto.importPemPrivateKey(fs.readFileSync(process.argv[3])); | ||
var certDER = fs.readFileSync(process.argv[2]) | ||
var certDERB64URL = util.b64enc(new Buffer(certDER)) | ||
var revokeMessage = JSON.stringify({ | ||
// For some reason forge adds an extra, incorrect '00' at the front of the | ||
// serial number. | ||
certificate: certDERB64URL | ||
}); | ||
console.log('Requesting revocation:', revokeMessage) | ||
var jws = crypto.generateSignature(key, new Buffer(revokeMessage)); | ||
var req = request.post('http://localhost:4000/acme/revoke-cert/', function(err, resp) { | ||
if (err) { | ||
console.log('Error: ', err); | ||
} | ||
console.log(resp.statusCode); | ||
console.log(resp.headers); | ||
console.log(resp.body); | ||
}); | ||
var payload = JSON.stringify(jws); | ||
console.log(payload); | ||
req.write(payload); | ||
req.end(); | ||
} | ||
main(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters