How to use the graphene-pk11.ObjectClass.SECRET_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 / src / mechs / aes / crypto.ts View on Github external
protected static createTemplate(session: graphene.Session, alg: AesKeyGenParams, extractable: boolean, keyUsages: string[]): ITemplate {

    const id = utils.GUID(session);
    return {
      token: !!process.env.WEBCRYPTO_PKCS11_TOKEN,
      sensitive: !!process.env.WEBCRYPTO_PKCS11_SENSITIVE,
      class: ObjectClass.SECRET_KEY,
      keyType: KeyType.AES,
      label: `AES-${alg.length}`,
      id,
      extractable,
      derive: false,
      sign: keyUsages.indexOf("sign") !== -1,
      verify: keyUsages.indexOf("verify") !== -1,
      encrypt: keyUsages.indexOf("encrypt") !== -1 || keyUsages.indexOf("wrapKey") !== -1,
      decrypt: keyUsages.indexOf("decrypt") !== -1 || keyUsages.indexOf("unwrapKey") !== -1,
      wrap: keyUsages.indexOf("wrapKey") !== -1,
      unwrap: keyUsages.indexOf("unwrapKey") !== -1,
    };
  }
github PeculiarVentures / node-webcrypto-p11 / src / key.ts View on Github external
constructor(key: Key, alg: T) {
    super();
    this.p11Object = key;
    switch (key.class) {
      case ObjectClass.PUBLIC_KEY:
        this.initPublicKey(key.toType());
        break;
      case ObjectClass.PRIVATE_KEY:
        this.initPrivateKey(key.toType());
        break;
      case ObjectClass.SECRET_KEY:
        this.initSecretKey(key.toType());
        break;
      default:
        throw new core.CryptoError(`Wrong incoming session object '${ObjectClass[key.class]}'`);
    }
    this.algorithm = alg;
    this.id = CryptoKey.getID(key);

    this.onAssign();
  }
github PeculiarVentures / node-webcrypto-p11 / lib / crypto / aes.ts View on Github external
export function create_template(session: Session, alg: AesKeyGenParams, extractable: boolean, keyUsages: string[]): ITemplate {

    const id = utils.GUID(session);
    return {
        token: !!process.env.WEBCRYPTO_PKCS11_TOKEN,
        sensitive: !!process.env.WEBCRYPTO_PKCS11_SENSITIVE,
        class: ObjectClass.SECRET_KEY,
        keyType: KeyType.AES,
        label: `AES-${alg.length}`,
        id,
        extractable,
        derive: false,
        sign: keyUsages.indexOf("sign") !== -1,
        verify: keyUsages.indexOf("verify") !== -1,
        encrypt: keyUsages.indexOf("encrypt") !== -1,
        decrypt: keyUsages.indexOf("decrypt") !== -1,
        wrap: keyUsages.indexOf("wrapKey") !== -1,
        unwrap: keyUsages.indexOf("unwrapKey") !== -1,
    };
}