TODO

Example

TODO

Hierarchy

  • Crypto

Constructors

Properties

This is BlueStep's implentation of the io.jsonwebtoken java library.

We have exposed the entirety of the library as it is documented in the official version 0.11.5 documentation, however bsjs documentation for this object will only extend to methods/classes required for our needs as of the time of this implementation.

Clearly more robust usage of this library is possible if we were to provide access to additional objects, and should such a need arise please contact the BlueStep engineering team to make a request.

Methods

  • Returns a Certificate using a provided type

    Parameters

    • type: string

      X.509

    • certificate: string | InputStream | ByteArray

      BEGIN CERTIFICATE----- XXXXXXXXXXXXXXXXXXXXXXXXXXX -----END CERTIFICATE-----

    Returns Certificate

  • Returns a PrivateKey using a provided algorithm from a PEM encoded using PKCS8 and Base64.

    Parameters

    • privateKeyAlgorithm: string

      RSA

    • privatePem: string

      BEGIN PRIVATE KEY----- XXXXXXXXXXXXXXXXXXXXXXXXXXX -----END PRIVATE KEY-----

    Returns PrivateKey

  • Returns a PrivateKey using a provided algorithm from a PEM encoded using PKCS8 as bytes.

    Parameters

    • privateKeyAlgorithm: string

      RSA

    • privateKeyBytes: ByteArray

    Returns PrivateKey

  • Returns a Public Key using a provided algorithm from a PEM encoded using 509 and Base64.

    Parameters

    • publicKeyAlgorithm: string

      RSA

    • publicPem: string

      BEGIN PUBLIC KEY----- XXXXXXXXXXXXXXXXXXXXXXXXXXX -----END PUBLIC KEY-----

    Returns PublicKey

  • Returns a Public Key using a provided algorithm from a PEM encoded using 509 as bytes.

    Parameters

    • publicKeyAlgorithm: string

      RSA

    • publicKeyBytes: ByteArray

    Returns PublicKey

  • Produce a hash using a provided digest algorithm and an InputStream. See also [[secureHash]].

    Parameters

    • hashAlgorithm: string

      Hash algorithm like SHA-256

    • input: InputStream | Reader

      What to create a hash from.

    Returns MessageDigest

    Example

    const salt = B.user.id;
    const secret = someInputStream;
    const hash = B.text.toBase64(B.crypto.hash('SHA-256', secret));
  • Produce a hash using a provided digest algorithm. See also [[secureHash]].

    Parameters

    • hashAlgorithm: string

      Hash algorithm like SHA-256

    • input: string | ByteArray

      What to create a hash from.

    Returns MessageDigest

    Example

    const salt = B.user.id;
    const secret = 'my secret';
    const hash = B.text.toHex(B.crypto.hash('SHA-256', secret + salt));
  • Produce a hash using a provided mac algorithm and an InputStream.

    Parameters

    • hashAlgorithm: string

      Hash algorithm like HmacSHA256

    • input: InputStream | Reader

      What to create a hash from.

    • key: string | ByteArray

      Key to use when getting mac hash.

    Returns Mac

    Example

    const salt = B.user.id;
    const secret = someTypeOfInputStream;
    const hash = B.text.toBase64(B.crypto.mac('HmacSHA256', secret, 'password'));
  • Produce a hash using a provided mac algorithm.

    Parameters

    • macAlgorithm: string

      Mac algorithm like HmacSHA256

    • input: string | ByteArray

      What to create a hash from.

    • key: string | ByteArray

      Key to use when getting mac hash.

    Returns Mac

    Example

    const salt = B.user.id;
    const secret = 'my secret';
    const hash = B.toBase64(B.crypto.mac('HmacSHA256', secret + salt));
  • Returns a [[Java.crypto.Mac]] using a provided mac algorithm.

    Parameters

    • macAlgorithm: string

      Mac algorithm like HmacSHA256

    • key: string | string[] | ByteArray

      Key to use when getting mac hash.

    Returns Mac

  • Returns a [[Java.crypto.MessageDigest]] using a provided MessageDigest algorithm.

    Parameters

    • digestAlgorithm: string

      Hash algorithm like SHA-256

    Returns MessageDigest

  • Returns a Java.ByteArray from a pem

    Parameters

    • pem: string

      BEGIN PRIVATE KEY----- XXXXXXXXXXXXXXXXXXXXXXXXXXX -----END PRIVATE KEY-----

    Returns ByteArray

  • Returns a signature in Base64 signed using a PrivateKey and updated with stringToSign

    Parameters

    • signingAlgorithm: string

      SHA256withRSA

    • stringToSign: string
    • privateKey: PrivateKey

    Returns string

  • Returns a signature as bytes using a PrivateKey and dataToSign

    Parameters

    Returns ByteArray

  • Returns a Signature using a provided algorithm.

    Parameters

    • signingAlgorithm: string

      SHA256withRSA

    Returns Signature

  • Returns a Signature using a provided algorithm.

    Parameters

    • signingAlgorithm: string

      SHA256withRSA

    • provider: string

      Provider name

    Returns Signature

  • Returns a Signature using a provided algorithm.

    Parameters

    • signingAlgorithm: string

      SHA256withRSA

    • provider: Provider

    Returns Signature

  • Returns a Signature signed using a PrivateKey and updated with stringToSign.

    Parameters

    • signingAlgorithm: string

      SHA256withRSA

    • stringToSign: string
    • privateKey: PrivateKey

    Returns Signature

  • Returns a Signature signed using a PrivateKey and updated with dataToSign

    Parameters

    Returns Signature

  • Returns a Signature using a Certificate

    Parameters

    • signingAlgorithm: string

      SHA256withRSA

    • certificate: Certificate

    Returns Signature

  • Returns a Signature using a PublicKey

    Parameters

    • signingAlgorithm: string

      SHA256withRSA

    • publicKey: PublicKey

    Returns Signature

  • Verifies a Signature using a Certificate and updated with data to verify with a signature.

    Parameters

    • signingAlgorithm: string

      SHA256withRSA

    • data: string
    • signature: string
    • certificate: Certificate

    Returns boolean

  • Verifies a Signature using a Certificate and updated with data

    Parameters

    Returns boolean

  • Verifies a Signature using a PublicKey and updated with data to verify with a signature.

    Parameters

    • signingAlgorithm: string

      SHA256withRSA

    • data: string
    • signature: string
    • publicKey: PublicKey

    Returns boolean

  • Verifies a Signature using a PublicKey and updated with data

    Parameters

    Returns boolean

Generated using TypeDoc