This file contains hidden or 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 gist assumes you have a signed document, the certificate chain used to sign it and the certificate chain of a TSA (if you used one) | |
# signed_doc = HexaPDF::Document.open(File.join(base_path, 'signed-document.pdf')) | |
# sig_cert_chain = [end_user_cert, intermediate_cert, root_cert] | |
# tsa_cert_chain = [tsa_cert, tsa_intermediate_cert, tsa_root_cert] | |
# optional: output_path = File.join(base_path, 'signed-document-with-ltv.pdf') | |
# STEP 1: The base structure is added as indirect references all | |
signed_doc.catalog[:DSS] = signed_doc.add({}) | |
signed_doc.catalog[:DSS][:CRLs] = signed_doc.add([]) | |
signed_doc.catalog[:DSS][:Certs] = signed_doc.add([]) |
This file contains hidden or 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
var module; | |
module = (function() { | |
return { | |
enc: function(key_str, pt1_str) { | |
var encrypt, key, pt1; | |
key = new Buffer(key_str); | |
pt1 = new Buffer(pt1_str); | |
encrypt = require('triplesec').encrypt; | |
return encrypt({ |
This file contains hidden or 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
module = do -> | |
enc: (key_str, pt1_str) -> | |
key = new Buffer key_str | |
pt1 = new Buffer pt1_str | |
{encrypt} = require 'triplesec' | |
encrypt { key, data : pt1 }, (err, ciphertext) -> | |
console.log ciphertext.toString('base64') | |
dec: (key_str, ciphertext_str) -> | |
key = new Buffer key_str |