How to use the graphene-pk11.AesGcm240Params 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 / aes.ts View on Github external
protected static wc2pk11(alg: AesGcmParams, session?: Session): IAlgorithm {
        const aad = alg.additionalData ? utils.PrepareData(alg.additionalData) : undefined;
        let AesGcmParamsClass = graphene.AesGcmParams;
        if (session &&
            session.slot.module.cryptokiVersion.major >= 2 &&
            session.slot.module.cryptokiVersion.minor >= 40) {
            AesGcmParamsClass = graphene.AesGcm240Params;
        }
        const params = new AesGcmParamsClass(utils.PrepareData(alg.iv), aad, alg.tagLength || 128);
        return { name: "AES_GCM", params };
    }
github PeculiarVentures / node-webcrypto-p11 / src / mechs / aes / crypto.ts View on Github external
protected static wc2pk11(session: graphene.Session, algorithm: Algorithm) {
    if (this.isAesGCM(algorithm)) {
      const aad = algorithm.additionalData ? utils.prepareData(algorithm.additionalData) : undefined;
      let AesGcmParamsClass = graphene.AesGcmParams;
      if (session &&
        session.slot.module.cryptokiVersion.major >= 2 &&
        session.slot.module.cryptokiVersion.minor >= 40) {
        AesGcmParamsClass = graphene.AesGcm240Params;
      }
      const params = new AesGcmParamsClass(utils.prepareData(algorithm.iv), aad, algorithm.tagLength || 128);
      return { name: "AES_GCM", params };
    } else if (this.isAesCBC(algorithm)) {
      return { name: "AES_CBC_PAD", params: utils.prepareData(algorithm.iv) };
    } else if (this.isAesECB(algorithm)) {
      return { name: "AES_ECB", params: null };
    } else {
      throw new core.OperationError("Unrecognized algorithm name");
    }
  }