Skip to content

Instantly share code, notes, and snippets.

const pkcs11 = require("pkcs11js");
const ffi = require("ffi");
const ref = require("ref");
const ArrayType = require('ref-array')
const StructType = require("ref-struct");
const KEYPAIR_ID = Buffer.from("GOST keypair");
// PKCS11 types
const CK_BYTE = ref.types.byte;
@microshine
microshine / fortify.html
Last active May 15, 2018 17:25
fortify token event
<!DOCTYPE html>
<!-- Data signing/verify -->
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Example #5</title>
<script src="https://peculiarventures.github.io/pv-webcrypto-tests/src/promise.js"></script>
@microshine
microshine / launch.json
Last active October 22, 2018 08:01
Launch TS script from vscode
{
"version": "0.2.0",
"configurations": [
{
"name": "Test all files",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
"args": [
"--no-timeouts",
@microshine
microshine / main.cpp
Created April 12, 2018 09:33
OSX add key to keychain
#include <iostream>
#include <CoreFoundation/CoreFoundation.h>
#include <Security/Security.h>
#define SUCCESS printf("%s: OK\n", __FUNCTION__)
static CFStringRef kSecAttrLabelTestApplication = CFSTR("test-application");
template<typename T>
class CFRef {
@microshine
microshine / xades-epes-example.js
Last active July 31, 2018 16:10
XAdES EPES example
const fs = require("fs");
const WebCrypto = require("node-webcrypto-ossl");
const xadesjs = require("xadesjs");
const { XMLSerializer } = require("xmldom-alpha");
const crypto = new WebCrypto();
xadesjs.Application.setEngine("OpenSSL", crypto);
function preparePem(pem) {
return pem
@microshine
microshine / fortify_windows.md
Created October 13, 2017 07:55
Describes steps to get more info about Fortify work

Check config.json

check if you have enabled Fortify log

\Users<user>.fortify\config.json

if no

echo {"logging":true} &gt; \Users\\.fortify\config.json