Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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);
}
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;
}
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);
}
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;
}