New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

graphene-pk11

Package Overview
Dependencies
Maintainers
2
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphene-pk11 - npm Package Compare versions

Comparing version 2.0.19 to 2.0.20

test/digest.js

0

capabilities/Safenet.md

@@ -0,0 +0,0 @@ **PKCS #11 DEVICE CAPABILITIES**

@@ -0,0 +0,0 @@ **[SafeNet Luna G5](http://www.safenet-inc.com/data-encryption/hardware-security-modules-hsms/luna-hsms-key-management/luna-G5-usb-attached-hsm/) PKCS #11 DEVICE CAPABILITIES**

@@ -0,0 +0,0 @@ **SoftHSM2 PKCS#11 DEVICE CAPABILITIES**

@@ -0,0 +0,0 @@ **Thales nShield PKCS#11 DEVICE CAPABILITIES**

@@ -0,0 +0,0 @@ **Thales nShield PCI 500 F3 PKCS#11 DEVICE CAPABILITIES**

@@ -0,0 +0,0 @@ **Thales nShield Solo+ PKCS#11 DEVICE CAPABILITIES**

@@ -0,0 +0,0 @@ ##Device Capabilities

@@ -0,0 +0,0 @@ The MIT License (MIT)

7

package.json
{
"name": "graphene-pk11",
"version": "2.0.19",
"version": "2.0.20",
"description": "A simple layer for interacting with PKCS #11 / PKCS11 / CryptoKI for Node in TypeScript",

@@ -15,3 +15,3 @@ "main": "./build/graphene.js",

"build:source": "tsc --sourceMap",
"pub": "npm run build && npm test && npm version patch && npm publish && git push",
"pub": "npm run build && npm version patch && npm publish && git push",
"sync": "git ac && git pull --rebase && git push",

@@ -36,3 +36,4 @@ "coverage": "npm run build:source && nyc npm test",

"@types/node": "^6.0.46",
"pkcs11js": "latest",
"pkcs11js": "^1.0.7",
"tslib": "^1.5.0",
"typescript": "^2"

@@ -39,0 +40,0 @@ },

@@ -0,0 +0,0 @@ # Graphene

@@ -0,0 +0,0 @@ # Scenarios

@@ -0,0 +0,0 @@ export * from "./core/object";

@@ -0,0 +0,0 @@ import * as pkcs11 from "pkcs11js";

@@ -0,0 +0,0 @@ export class Pkcs11Error extends Error {

@@ -0,0 +0,0 @@ import * as pkcs11 from "pkcs11js";

@@ -0,0 +0,0 @@ export function isString(v: any) {

@@ -0,0 +0,0 @@ export function dateFromString(text: string) {

@@ -0,0 +0,0 @@ import * as pkcs11 from "pkcs11js";

@@ -0,0 +0,0 @@ export * from "./cipher";

@@ -0,0 +0,0 @@ import * as pkcs11 from "pkcs11js";

@@ -0,0 +0,0 @@ import * as pkcs11 from "pkcs11js";

@@ -0,0 +0,0 @@ import * as pkcs11 from "pkcs11js";

@@ -0,0 +0,0 @@ import * as pkcs11 from "pkcs11js";

@@ -0,0 +0,0 @@ export * from "./core";

@@ -0,0 +0,0 @@ import * as pkcs11 from "pkcs11js";

@@ -0,0 +0,0 @@ import * as pkcs11 from "pkcs11js";

@@ -0,0 +0,0 @@ import * as pkcs11 from "pkcs11js";

@@ -0,0 +0,0 @@ export * from "./params"

@@ -0,0 +0,0 @@ export * from "../core";

@@ -0,0 +0,0 @@ const namedCurves: INamedCurve[] = [

@@ -0,0 +0,0 @@ import * as pkcs11 from "pkcs11js";

@@ -0,0 +0,0 @@ import * as pkcs11 from "pkcs11js";

@@ -0,0 +0,0 @@ export interface IParams {

@@ -0,0 +0,0 @@ import * as pkcs11 from "pkcs11js";

@@ -0,0 +0,0 @@ import * as pkcs11 from "pkcs11js";

@@ -0,0 +0,0 @@ import * as pkcs11 from "pkcs11js";

@@ -0,0 +0,0 @@ import * as pkcs11 from "pkcs11js";

@@ -0,0 +0,0 @@ import * as pkcs11 from "pkcs11js";

@@ -0,0 +0,0 @@ import * as pkcs11 from "pkcs11js";

@@ -126,3 +126,3 @@ import * as pkcs11 from "pkcs11js";

tmpl[name] = value;
this.setAttribute(tmpl[name]);
this.setAttribute(tmpl);
}

@@ -188,5 +188,5 @@

// import must be here, because other class from SessioObject must be initialized
// import must be here, because other class from SessionObject must be initialized
import * as objects from "./objects/common";
export * from "./objects/common";
export * from "./keys/common";

@@ -0,0 +0,0 @@ import {Certificate} from "./cert";

@@ -0,0 +0,0 @@ import * as pkcs11 from "pkcs11js";

@@ -0,0 +0,0 @@ export * from "./cert";

@@ -84,7 +84,7 @@ import {Certificate} from "./cert";

*/
get subjetcKeyIdentifier(): Buffer {
get subjectKeyIdentifier(): Buffer {
return this.get("ski");
}
set subjetcKeyIdentifier(v: Buffer) {
set subjectKeyIdentifier(v: Buffer) {
this.set("ski", v);

@@ -91,0 +91,0 @@ }

@@ -91,7 +91,7 @@ import {Certificate} from "./cert";

*/
get subjetcKeyIdentifier(): Buffer {
get subjectKeyIdentifier(): Buffer {
return this.get("ski");
}
set subjetcKeyIdentifier(v: Buffer) {
set subjectKeyIdentifier(v: Buffer) {
this.set("ski", v);

@@ -98,0 +98,0 @@ }

@@ -0,0 +0,0 @@ export * from "./storage";

@@ -0,0 +0,0 @@ import {Storage} from "./storage";

@@ -0,0 +0,0 @@ import {Storage} from "./storage";

@@ -0,0 +0,0 @@ export * from "./key";

@@ -0,0 +0,0 @@ import {Storage} from "../storage";

@@ -0,0 +0,0 @@ import {Key} from "./key";

@@ -0,0 +0,0 @@ import {Key} from "./key";

@@ -0,0 +0,0 @@ import {Key} from "./key";

@@ -0,0 +0,0 @@ import {SessionObject} from "../object";

@@ -59,2 +59,3 @@ import * as pkcs11 from "pkcs11js";

this.slot = slot;
this.getInfo();
}

@@ -90,3 +91,3 @@

protected getInfo() {
let info = this.lib.C_GetSessionInfo(this.slot.handle);
let info = this.lib.C_GetSessionInfo(this.handle);

@@ -93,0 +94,0 @@ this.state = info.state;

@@ -41,3 +41,3 @@ import * as pkcs11 from "pkcs11js";

/**
* Recieve information about Slot
* Receive information about Slot
*

@@ -44,0 +44,0 @@ * @protected

@@ -161,3 +161,3 @@ import * as pkcs11 from "pkcs11js";

/**
* CKA_PRIVATE_EXPONEN
* CKA_PRIVATE_EXPONENT
*/

@@ -182,3 +182,3 @@ privateExponent?: Buffer | null;

/**
* CKA_COEFFICIEN
* CKA_COEFFICIENT
*/

@@ -306,3 +306,3 @@ coefficient?: Buffer | null;

*/
otppinReq?: any | null;
otpPinReq?: any | null;
/**

@@ -399,3 +399,3 @@ * CKA_OTP_COUNTER

*/
suportedCmsAttrs?: any | null;
supportedCmsAttrs?: any | null;
/**

@@ -408,3 +408,3 @@ * CKA_ALLOWED_MECHANISMS

const TYPE_NUMBER = "number";
const TYPE_BOOL = "boolen";
const TYPE_BOOL = "boolean";
const TYPE_STRING = "string";

@@ -518,3 +518,3 @@ const TYPE_BUFFER = "buffer";

/* CKA_OTP... atttributes are new for PKCS #11 v2.20 amendment 3. */
/* CKA_OTP... attributes are new for PKCS #11 v2.20 amendment 3. */
otpFormat: pkcs11.CKA_OTP_FORMAT,

@@ -527,3 +527,3 @@ otpLength: pkcs11.CKA_OTP_LENGTH,

otpCounterReq: pkcs11.CKA_OTP_COUNTER_REQUIREMENT,
otppinReq: pkcs11.CKA_OTP_PIN_REQUIREMENT,
otpPinReq: pkcs11.CKA_OTP_PIN_REQUIREMENT,
otpCounter: pkcs11.CKA_OTP_COUNTER,

@@ -557,3 +557,3 @@ otpTime: pkcs11.CKA_OTP_TIME,

defaultCmsAttrs: pkcs11.CKA_DEFAULT_CMS_ATTRIBUTES,
suportedCmsAttrs: pkcs11.CKA_SUPPORTED_CMS_ATTRIBUTES,
supportedCmsAttrs: pkcs11.CKA_SUPPORTED_CMS_ATTRIBUTES,
allowedMechanisms: pkcs11.CKA_ALLOWED_MECHANISMS

@@ -568,3 +568,3 @@ };

let attr = (attribute as any)[name];
if (attr && "v" in attr)
if (attr !== void 0 && "v" in attr)
return attr.v;

@@ -604,3 +604,3 @@ throw new Error(`Unsupported attribute name '${name}'`);

default:
throw new Error(`Uknown type in use '${type}'`);
throw new Error(`Unknown type in use '${type}'`);
}

@@ -607,0 +607,0 @@ }

@@ -0,0 +0,0 @@ import * as pkcs11 from "pkcs11js";

@@ -0,0 +0,0 @@ var assert = require('assert');

@@ -20,3 +20,4 @@ {

"minPinLen": 4
}
},
"mechanisms": 66
},

@@ -23,0 +24,0 @@ "slotsCount": 2

@@ -22,2 +22,3 @@ interface IInit {

};
mechanisms: number;
};

@@ -24,0 +25,0 @@ slotsCount: number;

@@ -0,0 +0,0 @@ var assert = require('assert');

@@ -0,0 +0,0 @@ /// <reference path="../index.d.ts" />

@@ -0,0 +0,0 @@ var assert = require('assert');

@@ -13,5 +13,6 @@ var assert = require('assert');

mod.initialize();
session = mod.getSlots(config.controlValues.slot.slotIndex).open();
var slot = mod.getSlots(config.controlValues.slot.slotIndex);
session = slot.open(2 | 4);
session.login(config.init.pin);
modulus = new Buffer(1024/8);
modulus = new Buffer(1024 / 8);
modulus[127] = 1;

@@ -89,3 +90,3 @@ exponent = new Buffer([1, 0, 1]);

obj.setAttribute("label", "new label");
assert.equal(obj.getAttribute("label").label,"new label");
assert.equal(obj.getAttribute("label").label, "new label");
});

@@ -108,3 +109,3 @@

});
it("destroy", function () {

@@ -121,3 +122,3 @@ var count = session.find().length;

assert.equal(session.find().length, count + 1);
obj.destroy();

@@ -127,2 +128,43 @@ assert.equal(session.find().length, count);

it("size", function () {
var obj = session.create({
class: graphene.ObjectClass.PUBLIC_KEY,
label: "label",
keyType: graphene.KeyType.RSA,
wrap: true,
modulus: modulus,
publicExponent: exponent
});
// SoftHSM doesn't return real size of object
assert.equal(obj.size > 0, true)
obj.destroy();
});
it("set function", function () {
var obj = session.create({
class: graphene.ObjectClass.DATA,
label: "data.set",
objectId: new Buffer([1]),
token: false,
value: new Buffer("Hello"),
});
var data = obj.toType();
assert.equal(data.value.toString(), "Hello");
assert.equal(data.token, false);
assert.equal(data.private, true);
assert.equal(data.modifiable, true);
assert.equal(data.objectId.toString("hex"), "01");
data.label = "data.new.label";
var objs = session.find({label: "data.new.label"});
assert.equal(objs.length, 1);
data = objs.items(0).toType();
assert.equal(data.label, "data.new.label");
data.destroy();
});
});

@@ -0,0 +0,0 @@ var assert = require('assert');

@@ -0,0 +0,0 @@ var assert = require('assert');

@@ -32,7 +32,7 @@ var assert = require("assert");

var slot = slots.items(config.controlValues.slot.slotIndex);
// slot
assert.notEqual(slot.flags, 0);
assert.equal(slot.manufacturerID,
config.controlValues.slot.token.manufacturerID);
config.controlValues.slot.token.manufacturerID);
assert.notEqual(slot.slotDescription, "");

@@ -43,3 +43,3 @@ });

var slot = slots.items(config.controlValues.slot.slotIndex);
// token

@@ -52,9 +52,57 @@ var token = slot.getToken();

assert.equal(token.minPinLen, config.controlValues.slot.token.minPinLen);
if(token.flags & pkcs11.CKF_CLOCK_ON_TOKEN) {
assert.notEqual(token.timeUtc, undefined);
if (token.flags & pkcs11.CKF_CLOCK_ON_TOKEN) {
assert.notEqual(token.timeUtc, undefined);
} else {
assert.equal(token.timeUtc, undefined);
assert.equal(token.timeUtc, undefined);
}
});
context("mechanism", () => {
it("create from unsupported mechanism id", () => {
assert.throws(() => {
graphene.Mechanism.create("UNKNOWN_ALGORITHM");
}, (err) => {
assert.equal(err.message, "Unknown mechanism name 'UNKNOWN_ALGORITHM'");
return true;
});
});
it("collection", () => {
var slot = slots.items(config.controlValues.slot.slotIndex);
var mechanisms = slot.getMechanisms();
assert.equal(mechanisms.length, config.controlValues.slot.mechanisms);
var mech = mechanisms.items(0);
assert.equal(mech.name, "MD5");
});
context("vendor", () => {
it("json", () => {
graphene.Mechanism.vendor("./vendor/safenet_v5_3.json")
assert.equal(graphene.MechanismEnum.DES3_CBC_PAD_IPSEC, 2147483950);
});
it("name, value", () => {
graphene.Mechanism.vendor("CUSTOM_ALG", 888888888);
assert.equal(graphene.MechanismEnum.CUSTOM_ALG, 888888888);
});
});
});
it("close all", () => {
var slot = slots.items(config.controlValues.slot.slotIndex);
var session = slot.open();
assert.equal(session.flags, graphene.SessionFlag.SERIAL_SESSION);
slot.closeAll();
// must throw CKR_SESSION_HANDLE_INVALID:179
assert.throws(() => {
session.close()
});
});
});

@@ -9,2 +9,3 @@ {

"newLine": "LF",
"importHelpers": true,
"removeComments": true,

@@ -11,0 +12,0 @@ "noImplicitAny": true,

@@ -0,0 +0,0 @@ {

@@ -0,0 +0,0 @@ {

@@ -0,0 +0,0 @@ {

@@ -0,0 +0,0 @@ {

@@ -0,0 +0,0 @@ {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc