How to use the webcrypto-core.DesProvider 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 / webcrypto-liner / src / mechs / des / des_ede3_cbc.ts View on Github external
import * as core from "webcrypto-core";
import { DesCrypto } from "./crypto";
import { DesCryptoKey } from "./key";

export type DesEde3CbcParams = core.DesParams;

export class DesEde3CbcProvider extends core.DesProvider {

  public keySizeBits = 192;
  public ivSize = 8;
  public name = "DES-EDE3-CBC";

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

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

  public async onImportKey(format: KeyFormat, keyData: JsonWebKey | ArrayBuffer, algorithm: core.DesImportParams, extractable: boolean, keyUsages: KeyUsage[]): Promise {
    return DesCrypto.importKey(format, keyData, algorithm, extractable, keyUsages);
  }
github PeculiarVentures / webcrypto / src / mechs / des / des_ede3_cbc.ts View on Github external
import * as core from "webcrypto-core";
import { CryptoKey } from "../../keys";
import { DesCrypto } from "./crypto";
import { DesCryptoKey } from "./key";

export type DesEde3CbcParams = core.DesParams;

export class DesEde3CbcProvider extends core.DesProvider {

  public keySizeBits = 192;
  public ivSize = 8;
  public name = "DES-EDE3-CBC";

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

    return key;
  }
github PeculiarVentures / webcrypto-liner / src / mechs / des / des_cbc.ts View on Github external
import * as core from "webcrypto-core";
import { DesCrypto } from "./crypto";
import { DesCryptoKey } from "./key";

export class DesCbcProvider extends core.DesProvider {

  public keySizeBits = 64;
  public ivSize = 8;
  public name = "DES-CBC";

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

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

  public async onImportKey(format: KeyFormat, keyData: JsonWebKey | ArrayBuffer, algorithm: core.DesImportParams, extractable: boolean, keyUsages: KeyUsage[]): Promise {
    return DesCrypto.importKey(format, keyData, algorithm, extractable, keyUsages);
  }
github PeculiarVentures / webcrypto / src / mechs / des / des_cbc.ts View on Github external
import * as core from "webcrypto-core";
import { CryptoKey } from "../../keys";
import { DesCrypto } from "./crypto";
import { DesCryptoKey } from "./key";

export type DesCbcParams = core.DesParams;

export class DesCbcProvider extends core.DesProvider {

  public keySizeBits = 64;
  public ivSize = 8;
  public name = "DES-CBC";

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

    return key;
  }