How to use the graphene-pk11.RsaPssParams 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 / rsa / rsa-pss.ts View on Github external
protected wc2pk11(alg: RsaPssParams, keyAlg: RsaHashedKeyAlgorithm): IAlgorithm {
      let mech: string;
      let param: graphene.RsaPssParams;
      const saltLen = alg.saltLength;
      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}'`);
      }
github PeculiarVentures / node-webcrypto-p11 / src / mechs / rsa / rsa-pss.ts View on Github external
protected wc2pk11(alg: RsaPssParams, keyAlg: RsaHashedKeyAlgorithm): IAlgorithm {
      let mech: string;
      let param: graphene.RsaPssParams;
      const saltLen = alg.saltLength;
      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);
github PeculiarVentures / node-webcrypto-p11 / lib / crypto / rsa.ts View on Github external
switch ((keyAlg as any).hash.name.toUpperCase()) {
            case "SHA-1":
                mech = "SHA1_RSA_PKCS_PSS";
                param = new graphene.RsaPssParams(MechanismEnum.SHA1, RsaMgf.MGF1_SHA1, saltLen);
                break;
            case "SHA-224":
                mech = "SHA224_RSA_PKCS_PSS";
                param = new graphene.RsaPssParams(MechanismEnum.SHA224, RsaMgf.MGF1_SHA224, saltLen);
                break;
            case "SHA-256":
                mech = "SHA256_RSA_PKCS_PSS";
                param = new graphene.RsaPssParams(MechanismEnum.SHA256, RsaMgf.MGF1_SHA256, saltLen);
                break;
            case "SHA-384":
                mech = "SHA384_RSA_PKCS_PSS";
                param = new graphene.RsaPssParams(MechanismEnum.SHA384, RsaMgf.MGF1_SHA384, saltLen);
                break;
            case "SHA-512":
                mech = "SHA512_RSA_PKCS_PSS";
                param = new graphene.RsaPssParams(MechanismEnum.SHA512, RsaMgf.MGF1_SHA512, saltLen);
                break;
            default:
                throw new AlgorithmError(AlgorithmError.UNSUPPORTED_ALGORITHM, (keyAlg as any).hash.name);
        }
        return { name: mech, params: param };
    }
}
github PeculiarVentures / node-webcrypto-p11 / lib / crypto / rsa.ts View on Github external
protected static wc2pk11(alg: Algorithm, keyAlg: Algorithm): IAlgorithm {
        let mech: string;
        let param: graphene.RsaPssParams;
        const saltLen = (alg as any).saltLength;
        switch ((keyAlg as any).hash.name.toUpperCase()) {
            case "SHA-1":
                mech = "SHA1_RSA_PKCS_PSS";
                param = new graphene.RsaPssParams(MechanismEnum.SHA1, RsaMgf.MGF1_SHA1, saltLen);
                break;
            case "SHA-224":
                mech = "SHA224_RSA_PKCS_PSS";
                param = new graphene.RsaPssParams(MechanismEnum.SHA224, RsaMgf.MGF1_SHA224, saltLen);
                break;
            case "SHA-256":
                mech = "SHA256_RSA_PKCS_PSS";
                param = new graphene.RsaPssParams(MechanismEnum.SHA256, RsaMgf.MGF1_SHA256, saltLen);
                break;
            case "SHA-384":
                mech = "SHA384_RSA_PKCS_PSS";
                param = new graphene.RsaPssParams(MechanismEnum.SHA384, RsaMgf.MGF1_SHA384, saltLen);
                break;
            case "SHA-512":
                mech = "SHA512_RSA_PKCS_PSS";
                param = new graphene.RsaPssParams(MechanismEnum.SHA512, RsaMgf.MGF1_SHA512, saltLen);
github PeculiarVentures / node-webcrypto-p11 / lib / crypto / rsa.ts View on Github external
protected static wc2pk11(alg: Algorithm, keyAlg: Algorithm): IAlgorithm {
        let mech: string;
        let param: graphene.RsaPssParams;
        const saltLen = (alg as any).saltLength;
        switch ((keyAlg as any).hash.name.toUpperCase()) {
            case "SHA-1":
                mech = "SHA1_RSA_PKCS_PSS";
                param = new graphene.RsaPssParams(MechanismEnum.SHA1, RsaMgf.MGF1_SHA1, saltLen);
                break;
            case "SHA-224":
                mech = "SHA224_RSA_PKCS_PSS";
                param = new graphene.RsaPssParams(MechanismEnum.SHA224, RsaMgf.MGF1_SHA224, saltLen);
                break;
            case "SHA-256":
                mech = "SHA256_RSA_PKCS_PSS";
                param = new graphene.RsaPssParams(MechanismEnum.SHA256, RsaMgf.MGF1_SHA256, saltLen);
                break;
            case "SHA-384":
                mech = "SHA384_RSA_PKCS_PSS";
                param = new graphene.RsaPssParams(MechanismEnum.SHA384, RsaMgf.MGF1_SHA384, saltLen);
                break;
            case "SHA-512":
                mech = "SHA512_RSA_PKCS_PSS";
                param = new graphene.RsaPssParams(MechanismEnum.SHA512, RsaMgf.MGF1_SHA512, saltLen);
                break;
            default:
                throw new AlgorithmError(AlgorithmError.UNSUPPORTED_ALGORITHM, (keyAlg as any).hash.name);
        }
github PeculiarVentures / node-webcrypto-p11 / src / mechs / rsa / rsa-pss.ts View on Github external
protected wc2pk11(alg: RsaPssParams, keyAlg: RsaHashedKeyAlgorithm): IAlgorithm {
      let mech: string;
      let param: graphene.RsaPssParams;
      const saltLen = alg.saltLength;
      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 };
    }