How to use the graphene-pk11.MechanismEnum 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 / test / rsa.js View on Github external
context("RSA_PKCS Sign/Verify", () => {
        const SHA256_RSA_PKCS = graphene.MechanismEnum["SHA256_RSA_PKCS"];

        before(() => {
            // delete SHA256_RSA_PKCS
            delete graphene.MechanismEnum["SHA256_RSA_PKCS"];
            delete graphene.MechanismEnum[SHA256_RSA_PKCS];
        })

        after(() => {
            // recover SHA256_RSA_PKCS
            graphene.MechanismEnum["SHA256_RSA_PKCS"] = SHA256_RSA_PKCS;
            graphene.MechanismEnum[SHA256_RSA_PKCS] = "SHA256_RSA_PKCS";
        })

        it("remove SHA256_RSA_PKCS mechanism", (done) => {
            const algorithm = {
                name: "RSASSA-PKCS1-v1_5",
github PeculiarVentures / node-webcrypto-p11 / test / rsa.js View on Github external
after(() => {
            // recover SHA256_RSA_PKCS
            graphene.MechanismEnum["SHA256_RSA_PKCS"] = SHA256_RSA_PKCS;
            graphene.MechanismEnum[SHA256_RSA_PKCS] = "SHA256_RSA_PKCS";
        })
github PeculiarVentures / node-webcrypto-p11 / test / rsa.js View on Github external
after(() => {
            // recover SHA256_RSA_PKCS
            graphene.MechanismEnum["SHA256_RSA_PKCS"] = SHA256_RSA_PKCS;
            graphene.MechanismEnum[SHA256_RSA_PKCS] = "SHA256_RSA_PKCS";
        })
github PeculiarVentures / node-webcrypto-p11 / src / mechs / rsa / rsa-pss.ts View on Github external
switch (keyAlg.hash.name.toUpperCase()) {
        case "SHA-1":
          mech = "SHA1_RSA_PKCS_PSS";
          param = new graphene.RsaPssParams(graphene.MechanismEnum.SHA1, graphene.RsaMgf.MGF1_SHA1, saltLen);
          break;
        case "SHA-224":
          mech = "SHA224_RSA_PKCS_PSS";
          param = new graphene.RsaPssParams(graphene.MechanismEnum.SHA224, graphene.RsaMgf.MGF1_SHA224, saltLen);
          break;
        case "SHA-256":
          mech = "SHA256_RSA_PKCS_PSS";
          param = new graphene.RsaPssParams(graphene.MechanismEnum.SHA256, graphene.RsaMgf.MGF1_SHA256, saltLen);
          break;
        case "SHA-384":
          mech = "SHA384_RSA_PKCS_PSS";
          param = new graphene.RsaPssParams(graphene.MechanismEnum.SHA384, graphene.RsaMgf.MGF1_SHA384, saltLen);
          break;
        case "SHA-512":
          mech = "SHA512_RSA_PKCS_PSS";
          param = new graphene.RsaPssParams(graphene.MechanismEnum.SHA512, graphene.RsaMgf.MGF1_SHA512, saltLen);
          break;
        default:
        throw new core.OperationError(`Cannot create PKCS11 mechanism from algorithm '${keyAlg.hash.name}'`);
      }
      return { name: mech, params: param };
    }