How to use the webcrypto-core.AesCbcProvider function in webcrypto-core

To help you get started, we’ve selected a few webcrypto-core 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 / aes_cbc.ts View on Github external
import * as core from "webcrypto-core";
import { Crypto } from "../../crypto";
import { CryptoKey } from "../../key";
import { AesCrypto } from "./crypto";

export class AesCbcProvider extends core.AesCbcProvider {

  constructor(public crypto: Crypto) {
    super();
  }

  public async onGenerateKey(algorithm: AesKeyGenParams, extractable: boolean, keyUsages: KeyUsage[]): Promise {
    const key = await AesCrypto.generateKey(
      this.crypto.session,
      {
        name: this.name,
        length: algorithm.length,
      },
      extractable,
      keyUsages);

    return key;
github PeculiarVentures / webcrypto / src / mechs / aes / aes_cbc.ts View on Github external
import * as core from "webcrypto-core";
import { AesCrypto } from "./crypto";
import { AesCryptoKey } from "./key";

export class AesCbcProvider extends core.AesCbcProvider {

  public async onGenerateKey(algorithm: AesKeyGenParams, extractable: boolean, keyUsages: KeyUsage[]): Promise {
    const key = await AesCrypto.generateKey(
      {
        name: this.name,
        length: algorithm.length,
      },
      extractable,
      keyUsages);

    return key;
  }

  public async onEncrypt(algorithm: Algorithm, key: AesCryptoKey, data: ArrayBuffer): Promise {
    return AesCrypto.encrypt(algorithm, key, new Uint8Array(data));
  }
github PeculiarVentures / webcrypto-liner / src / mechs / aes / aes_cbc.ts View on Github external
import * as core from "webcrypto-core";
import { AesCrypto } from "./crypto";
import { AesCryptoKey } from "./key";

export class AesCbcProvider extends core.AesCbcProvider {

  public async onGenerateKey(algorithm: AesKeyGenParams, extractable: boolean, keyUsages: KeyUsage[]): Promise {
    return AesCrypto.generateKey(algorithm, extractable, keyUsages);
  }

  public async onEncrypt(algorithm: AesCbcParams, key: AesCryptoKey, data: ArrayBuffer): Promise {
    return AesCrypto.encrypt(algorithm, key, data);
  }

  public async onDecrypt(algorithm: AesCbcParams, key: AesCryptoKey, data: ArrayBuffer): Promise {
    return AesCrypto.decrypt(algorithm, key, data);
  }

  public async onExportKey(format: KeyFormat, key: AesCryptoKey): Promise {
    return AesCrypto.exportKey(format, key);
  }