Class CryptoEngine

Default cryptographic engine for Web Cryptography API

Hierarchy

Constructors

Properties

crypto: Crypto
name: string
subtle: SubtleCrypto

Methods

  • Convert WebCrypto keys between different export formats

    Parameters

    • inputFormat: KeyFormat
    • outputFormat: KeyFormat
    • keyData: ArrayBuffer | JsonWebKey
    • algorithm: Algorithm
    • extractable: boolean
    • keyUsages: KeyUsage[]

    Returns Promise<ArrayBuffer | JsonWebKey>

  • Parameters

    • algorithm: AesCbcParams | AesCtrParams | AesGcmParams | AlgorithmIdentifier | RsaOaepParams
    • key: CryptoKey
    • data: BufferSource

    Returns Promise<ArrayBuffer>

  • Parameters

    • algorithm: EcdhKeyDeriveParams | AlgorithmIdentifier | HkdfParams | Pbkdf2Params
    • baseKey: CryptoKey
    • length: number

    Returns Promise<ArrayBuffer>

  • Parameters

    • algorithm: EcdhKeyDeriveParams | AlgorithmIdentifier | HkdfParams | Pbkdf2Params
    • baseKey: CryptoKey
    • derivedKeyType: AesDerivedKeyParams | AlgorithmIdentifier | HkdfParams | HmacImportParams | Pbkdf2Params
    • extractable: boolean
    • keyUsages: KeyUsage[]

    Returns Promise<CryptoKey>

  • Parameters

    • algorithm: EcdhKeyDeriveParams | AlgorithmIdentifier | HkdfParams | Pbkdf2Params
    • baseKey: CryptoKey
    • derivedKeyType: AesDerivedKeyParams | AlgorithmIdentifier | HkdfParams | HmacImportParams | Pbkdf2Params
    • extractable: boolean
    • keyUsages: Iterable<KeyUsage>

    Returns Promise<CryptoKey>

  • Parameters

    • algorithm: AesCbcParams | AesCtrParams | AesGcmParams | AlgorithmIdentifier | RsaOaepParams
    • key: CryptoKey
    • data: BufferSource

    Returns Promise<ArrayBuffer>

  • Parameters

    • algorithm: EcKeyGenParams | RsaHashedKeyGenParams
    • extractable: boolean
    • keyUsages: KeyUsage[]

    Returns Promise<CryptoKeyPair>

  • Parameters

    • algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params
    • extractable: boolean
    • keyUsages: KeyUsage[]

    Returns Promise<CryptoKey>

  • Parameters

    • algorithm: AlgorithmIdentifier
    • extractable: boolean
    • keyUsages: KeyUsage[]

    Returns Promise<CryptoKeyPair | CryptoKey>

  • Gets WebCrypto algorithm by wel-known OID

    Returns

    Returns WebCrypto algorithm or an empty object

    Type Parameters

    • T extends Algorithm = Algorithm

    Parameters

    • oid: string

      algorithm identifier

    • Optional safety: boolean

      if true throws exception on unknown algorithm identifier

    • Optional target: string

      name of the target

    Returns object | T

  • Gets WebCrypto algorithm by wel-known OID

    Returns

    Returns WebCrypto algorithm

    Throws

    Throws Error exception if unknown algorithm identifier

    Type Parameters

    • T extends Algorithm = Algorithm

    Parameters

    • oid: string

      algorithm identifier

    • safety: true

      if true throws exception on unknown algorithm identifier

    • Optional target: string

      name of the target

    Returns T

  • Get OID for each specific algorithm

    Throws

    Throws Error exception if unknown WebCrypto algorithm

    Parameters

    • algorithm: Algorithm

      WebCrypto Algorithm

    • safety: boolean = false

      If true throws exception on unknown algorithm. Default is false

    • Optional target: string

      Name of the target

    Returns string

  • Parameters

    • format: KeyFormat
    • keyData: BufferSource | JsonWebKey
    • algorithm: AlgorithmIdentifier
    • extractable: boolean
    • keyUsages: KeyUsage[]

    Returns Promise<CryptoKey>

  • Parameters

    • algorithm: EcdsaParams | AlgorithmIdentifier | RsaPssParams
    • key: CryptoKey
    • data: BufferSource

    Returns Promise<ArrayBuffer>

  • Parameters

    • format: KeyFormat
    • wrappedKey: BufferSource
    • unwrappingKey: CryptoKey
    • unwrapAlgorithm: AesCbcParams | AesCtrParams | AesGcmParams | AlgorithmIdentifier | RsaOaepParams
    • unwrappedKeyAlgorithm: AesKeyAlgorithm | EcKeyImportParams | AlgorithmIdentifier | HmacImportParams | RsaHashedImportParams
    • extractable: boolean
    • keyUsages: KeyUsage[]

    Returns Promise<CryptoKey>

  • Parameters

    • format: KeyFormat
    • wrappedKey: BufferSource
    • unwrappingKey: CryptoKey
    • unwrapAlgorithm: AesCbcParams | AesCtrParams | AesGcmParams | AlgorithmIdentifier | RsaOaepParams
    • unwrappedKeyAlgorithm: AesKeyAlgorithm | EcKeyImportParams | AlgorithmIdentifier | HmacImportParams | RsaHashedImportParams
    • extractable: boolean
    • keyUsages: Iterable<KeyUsage>

    Returns Promise<CryptoKey>

  • Parameters

    • algorithm: EcdsaParams | AlgorithmIdentifier | RsaPssParams
    • key: CryptoKey
    • signature: BufferSource
    • data: BufferSource

    Returns Promise<boolean>

  • Parameters

    • format: KeyFormat
    • key: CryptoKey
    • wrappingKey: CryptoKey
    • wrapAlgorithm: AesCbcParams | AesCtrParams | AesGcmParams | AlgorithmIdentifier | RsaOaepParams

    Returns Promise<ArrayBuffer>

Generated using TypeDoc