How to use the graphene-pk11.ObjectClass.PRIVATE_KEY function in graphene-pk11

To help you get started, we’ve selected a few graphene-pk11 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PeculiarVentures / node-webcrypto-p11 / lib / crypto / ec.ts View on Github external
function create_template(session: Session, alg: EcKeyGenParams, extractable: boolean, keyUsages: string[]): ITemplatePair {
    const label = `EC-${alg.namedCurve}`;
    const idKey = utils.GUID(session);
    const keyType = KeyType.ECDSA;
    return {
        privateKey: {
            token: !!process.env.WEBCRYPTO_PKCS11_TOKEN,
            sensitive: !!process.env.WEBCRYPTO_PKCS11_SENSITIVE,
            class: ObjectClass.PRIVATE_KEY,
            keyType,
            private: true,
            label,
            id: idKey,
            extractable,
            derive: keyUsages.indexOf("deriveKey") !== -1 || keyUsages.indexOf("deriveBits") !== -1,
            sign: keyUsages.indexOf("sign") !== -1,
            decrypt: keyUsages.indexOf("decrypt") !== -1,
            unwrap: keyUsages.indexOf("unwrapKey") !== -1,
        },
        publicKey: {
            token: !!process.env.WEBCRYPTO_PKCS11_TOKEN,
            class: ObjectClass.PUBLIC_KEY,
            keyType,
            private: false,
            label,
github PeculiarVentures / node-webcrypto-p11 / src / key.ts View on Github external
public static getID(p11Key: Key) {
    let name: string;
    switch (p11Key.class) {
      case ObjectClass.PRIVATE_KEY:
        name = "private";
        break;
      case ObjectClass.PUBLIC_KEY:
        name = "public";
        break;
      case ObjectClass.SECRET_KEY:
        name = "secret";
        break;
      default:
        throw new Error(`Unsupported Object type '${ObjectClass[p11Key.class]}'`);
    }
    return `${name}-${p11Key.handle.toString("hex")}-${p11Key.id.toString("hex")}`;
  }
github PeculiarVentures / node-webcrypto-p11 / src / mechs / rsa / crypto.ts View on Github external
protected static createTemplate(session: graphene.Session, alg: RsaHashedKeyGenParams, extractable: boolean, keyUsages: string[]): ITemplatePair {
    const label = `RSA-${alg.modulusLength}`;
    const idKey = utils.GUID(session);
    return {
      privateKey: {
        token: !!process.env.WEBCRYPTO_PKCS11_TOKEN,
        sensitive: !!process.env.WEBCRYPTO_PKCS11_SENSITIVE,
        class: ObjectClass.PRIVATE_KEY,
        keyType: KeyType.RSA,
        private: true,
        label,
        id: idKey,
        extractable,
        derive: false,
        sign: keyUsages.indexOf("sign") > -1,
        decrypt: keyUsages.indexOf("decrypt") > -1,
        unwrap: keyUsages.indexOf("unwrapKey") > -1,
      },
      publicKey: {
        token: !!process.env.WEBCRYPTO_PKCS11_TOKEN,
        class: ObjectClass.PUBLIC_KEY,
        keyType: KeyType.RSA,
        private: false,
        label,
github PeculiarVentures / node-webcrypto-p11 / lib / crypto / rsa.ts View on Github external
function create_template(session: Session, alg: RsaHashedKeyGenParams, extractable: boolean, keyUsages: string[]): ITemplatePair {
    const label = `RSA-${alg.modulusLength}`;
    const idKey = utils.GUID(session);
    return {
        privateKey: {
            token: !!process.env.WEBCRYPTO_PKCS11_TOKEN,
            sensitive: !!process.env.WEBCRYPTO_PKCS11_SENSITIVE,
            class: ObjectClass.PRIVATE_KEY,
            keyType: KeyType.RSA,
            private: true,
            label,
            id: idKey,
            extractable,
            derive: false,
            sign: keyUsages.indexOf("sign") > -1,
            decrypt: keyUsages.indexOf("decrypt") > -1,
            unwrap: keyUsages.indexOf("unwrapKey") > -1,
        },
        publicKey: {
            token: !!process.env.WEBCRYPTO_PKCS11_TOKEN,
            class: ObjectClass.PUBLIC_KEY,
            keyType: KeyType.RSA,
            private: false,
            label,