Options
All
  • Public
  • Public/Protected
  • All
Menu

Class implementing cryptographic operations required to create and verify the validity of Virgil Cards (i.e. the ICardCrypto interface from virgil-sdk), using VirgilCrypto.

Hierarchy

  • VirgilCardCrypto

Index

Constructors

constructor

Methods

exportPublicKey

  • Exports public key material in DER format from the given public key object.

    Parameters

    • publicKey: IPublicKey

      The public key object to export the key material from.

    Returns Buffer

    • The public key material in DER format.

generateSha512

  • generateSha512(data: Buffer | string): Buffer
  • Computes SHA-512 hash of the given data.

    Parameters

    • data: Buffer | string

      The data to be hashed.

    Returns Buffer

    • The resulting hash value.

generateSignature

  • generateSignature(data: Buffer | string, privateKey: IPrivateKey): Buffer
  • Generates digital signature of the given data using the given private key.

    Parameters

    • data: Buffer | string

      The data to be signed.

    • privateKey: IPrivateKey

      The private key object.

    Returns Buffer

    • The signature data.

importPublicKey

  • Creates a VirgilPublicKey object from public key material in PEM or DER format.

    Parameters

    • publicKeyData: Buffer | string

      The public key material. If publicKeyData is a string, base64 encoding is assumed.

    Returns VirgilPublicKey

    The public key object.

verifySignature

  • verifySignature(data: Buffer | string, signature: Buffer | string, publicKey: IPublicKey): boolean
  • Verifies the validity of the digital signature for the given data and public key.

    Parameters

    • data: Buffer | string

      The data that were signed.

    • signature: Buffer | string

      The signature.

    • publicKey: IPublicKey

      The signer's public key.

    Returns boolean

    • true if signature is valid, otherwise false