Options
All
  • Public
  • Public/Protected
  • All
Menu

Library namespace.

Index

Variables

Base

Base: { create: any; extend: any; mixIn: any }

Base object for prototypal inheritance.

Type declaration

  • create:function
    • create(...args: any[]): any
    • Extends this object and runs the init method. Arguments to create() will be passed to init().

      example
      var instance = MyType.create();
      

      Parameters

      • Rest ...args: any[]

      Returns any

      The new object.

  • extend:function
    • extend(overrides: object): any
    • Creates a new object that inherits from this object.

      example
      var MyType = CryptoJS.lib.Base.extend({
      field: 'value',

      method: function () {
      }
      });

      Parameters

      • overrides: object

        Properties to copy into the new object.

      Returns any

      The new object.

  • mixIn:function
    • mixIn(properties: object): any
    • Copies properties into this object.

      example
      MyType.mixIn({
      field: 'value'
      });

      Parameters

      • properties: object

        The properties to mix in.

      Returns any

BlockCipherMode

BlockCipherMode: any

Abstract base block cipher mode template.

BufferedBlockAlgorithm

BufferedBlockAlgorithm: any

Cipher

Cipher: { _createHelper: any }

Type declaration

  • _createHelper:function
    • _createHelper(cipher: Cipher): CipherHelper
    • Creates shortcut functions to a cipher's object interface.

      example
      var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES);
      

      Parameters

      • cipher: Cipher

        The cipher to create a helper for.

      Returns CipherHelper

      An object with encrypt and decrypt shortcut functions.

CipherParams

CipherParams: { create: any }

Type declaration

  • create:function
    • Initializes a newly created cipher params object.

      example
      var cipherParams = CryptoJS.lib.CipherParams.create({
      ciphertext: ciphertextWordArray,
      key: keyWordArray,
      iv: ivWordArray,
      salt: saltWordArray,
      algorithm: CryptoJS.algo.AES,
      mode: CryptoJS.mode.CBC,
      padding: CryptoJS.pad.PKCS7,
      blockSize: 4,
      formatter: CryptoJS.format.OpenSSL
      });

      Parameters

      Returns cryptojs.lib.CipherParams

Hasher

Hasher: { _createHelper: any; _createHmacHelper: any }

Type declaration

  • _createHelper:function
    • _createHelper(hasher: HasherStatic): HasherHelper
    • Creates a shortcut function to a hasher's object interface.

      example
      var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);
      

      Parameters

      • hasher: HasherStatic

        The hasher to create a helper for.

      Returns HasherHelper

      The shortcut function.

  • _createHmacHelper:function
    • _createHmacHelper(hasher: HasherStatic): HmacHasherHelper
    • Creates a shortcut function to the HMAC's object interface.

      example
      var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);
      

      Parameters

      • hasher: HasherStatic

        The hasher to use in this HMAC helper.

      Returns HmacHasherHelper

      The shortcut function.

PasswordBasedCipher

PasswordBasedCipher: { decrypt: any; encrypt: any }

A serializable cipher wrapper that derives the key from a password, and returns ciphertext as a serializable cipher params object.

Type declaration

  • decrypt:function
    • Decrypts serialized ciphertext using a password.

      example
      var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL });
      var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL });

      Parameters

      • cipher: CipherStatic

        The cipher algorithm to use.

      • ciphertext: string | cryptojs.lib.CipherParams

        The ciphertext to decrypt.

      • password: string

        The password.

      • Optional cfg: CipherOption

        (Optional) The configuration options to use for this operation.

      Returns cryptojs.lib.WordArray

      The plaintext.

  • encrypt:function
    • Encrypts a message using a password.

      example
      var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password');
      var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL });

      Parameters

      • cipher: CipherStatic

        The cipher algorithm to use.

      • message: string | cryptojs.lib.WordArray

        The message to encrypt.

      • password: string

        The password.

      • Optional cfg: CipherOption

        (Optional) The configuration options to use for this operation.

      Returns cryptojs.lib.CipherParams

      A cipher params object.

SerializableCipher

SerializableCipher: { _parse: any; decrypt: any; encrypt: any }

A cipher wrapper that returns ciphertext as a serializable cipher params object.

Type declaration

  • _parse:function
    • Converts serialized ciphertext to CipherParams, else assumed CipherParams already and returns ciphertext unchanged.

      example
      var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format);
      

      Parameters

      • ciphertext: string | cryptojs.lib.CipherParams

        The ciphertext.

      • format: Format

        The formatting strategy to use to parse serialized ciphertext.

      Returns cryptojs.lib.CipherParams

      The unserialized ciphertext.

  • decrypt:function
    • Decrypts serialized ciphertext.

      example
      var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL });
      var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL });

      Parameters

      • cipher: CipherStatic

        The cipher algorithm to use.

      • ciphertext: string | cryptojs.lib.WordArray

        The ciphertext to decrypt.

      • key: cryptojs.lib.WordArray

        The key.

      • Optional cfg: CipherOption

        (Optional) The configuration options to use for this operation.

      Returns cryptojs.lib.CipherParams

      The plaintext.

  • encrypt:function
    • Encrypts a message.

      example
      var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key);
      var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv });
      var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL });

      Parameters

      • cipher: CipherStatic

        The cipher algorithm to use.

      • message: string | cryptojs.lib.WordArray

        The message to encrypt.

      • key: cryptojs.lib.WordArray

        The key.

      • Optional cfg: CipherOption

        (Optional) The configuration options to use for this operation.

      Returns cryptojs.lib.CipherParams

      A cipher params object.

WordArray

WordArray: { create: any; random: any }

Type declaration

  • create:function
    • Initializes a newly created word array.

      example
      var wordArray = CryptoJS.lib.WordArray.create();
      var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);
      var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);

      Parameters

      • Optional words: number[]

        (Optional) An array of 32-bit words.

      • Optional sigBytes: number

        (Optional) The number of significant bytes in the words.

      Returns cryptojs.lib.WordArray

  • random:function
    • Creates a word array filled with random bytes.

      example
      var wordArray = CryptoJS.lib.WordArray.random(16);
      

      Parameters

      • nBytes: number

        The number of random bytes to generate.

      Returns cryptojs.lib.WordArray

      The random word array.

Generated using TypeDoc