From 0cb79aff7c028578ae57192ac773b3cd94fac57e Mon Sep 17 00:00:00 2001 From: UnumID Admin Date: Fri, 5 Nov 2021 19:12:54 +0000 Subject: [PATCH] [Release 1.7.0] sets rsa padding in encrypt, uses rsa padding value in decrypt --- docs/classes/cryptoerror.html | 4 ++-- docs/modules.html | 41 +++++++++++++++++++++++------------ package.json | 2 +- 3 files changed, 30 insertions(+), 17 deletions(-) diff --git a/docs/classes/cryptoerror.html b/docs/classes/cryptoerror.html index 2557d42..9057975 100644 --- a/docs/classes/cryptoerror.html +++ b/docs/classes/cryptoerror.html @@ -128,7 +128,7 @@

constructor

Parameters

@@ -153,7 +153,7 @@

code

code: undefined | string | number
diff --git a/docs/modules.html b/docs/modules.html index 99407df..17cf9e5 100644 --- a/docs/modules.html +++ b/docs/modules.html @@ -99,7 +99,7 @@

decrypt

  • @@ -147,7 +147,7 @@

    decryptBytes

  • @@ -187,13 +187,13 @@

    Returns Buffer

    encrypt

      -
    • encrypt(did: string, publicKey: string, data: unknown, encoding?: "base58" | "pem"): EncryptedData
    • +
    • encrypt(did: string, publicKey: string, data: unknown, encoding?: "base58" | "pem", rsaPadding?: RSAPadding): EncryptedData
    • @@ -229,6 +229,16 @@
      encoding: "base58"the encoding used for the publicKey ('base58' or 'pem', default 'pem')

    • +
    • +
      rsaPadding: RSAPadding = ...
      +
      +

      padding to use for RSA encryption (PKCS1 v1.5 or OAEP). + Necessary because web crypto only supports OAEP padding for decryption, + and cannot decrypt data encrypted with PKCS1 v1.5 padding. + Defaults to PKCS to preserve backwards compatibility, + as older public keys (from before we used web crypto) do not specify a padding.

      +
      +

    Returns EncryptedData

    contains the encrypted data as a base58 string plus RSA-encrypted/base58-encoded @@ -240,13 +250,13 @@

    Returns Encrypted

    encryptBytes

      -
    • encryptBytes(did: string, publicKey: string, data: BinaryLike, encoding?: "base58" | "pem"): EncryptedData
    • +
    • encryptBytes(did: string, publicKey: string, data: BinaryLike, encoding?: "base58" | "pem", rsaPadding?: RSAPadding): EncryptedData
    • @@ -280,6 +290,9 @@
      encoding: "base58"the encoding used for the publicKey ('base58' or 'pem', default 'pem')

    • +
    • +
      rsaPadding: RSAPadding = ...
      +

    Returns EncryptedData

    contains the encrypted data as a base58 string plus RSA-encrypted/base58-encoded @@ -297,7 +310,7 @@

    generateEccKeyPair

  • Parameters

    @@ -320,7 +333,7 @@

    generateRsaKeyPair

  • Parameters

    @@ -343,7 +356,7 @@

    sign

  • @@ -389,7 +402,7 @@

    signBytes

  • @@ -434,7 +447,7 @@

    validatePublicKey

  • Parameters

    @@ -467,7 +480,7 @@

    verify

  • @@ -519,7 +532,7 @@

    verifyBytes

  • @@ -570,7 +583,7 @@

    verifyString

  • diff --git a/package.json b/package.json index 859c11e..47c8316 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@unumid/library-crypto", - "version": "1.6.0", + "version": "1.7.0", "description": "A TypeScript library for Unum ID crypto operations", "main": "build/index.js", "repository": "git@github.com:UnumID/Library-Crypto-TypeScript",