diff --git a/libs/common/src/key-management/crypto/abstractions/crypto-function.service.ts b/libs/common/src/key-management/crypto/abstractions/crypto-function.service.ts index 705a1c1a24e..29f52705799 100644 --- a/libs/common/src/key-management/crypto/abstractions/crypto-function.service.ts +++ b/libs/common/src/key-management/crypto/abstractions/crypto-function.service.ts @@ -84,15 +84,6 @@ export abstract class CryptoFunctionService { key: Uint8Array, mode: "cbc" | "ecb", ): Promise; - /** - * @deprecated HAZMAT WARNING: DO NOT USE THIS FOR NEW CODE. Implement low-level crypto operations - * in the SDK instead. Further, you should probably never find yourself using this low-level crypto function. - */ - abstract rsaEncrypt( - data: Uint8Array, - publicKey: Uint8Array, - algorithm: "sha1" | "sha256", - ): Promise; /** * @deprecated HAZMAT WARNING: DO NOT USE THIS FOR NEW CODE. Implement low-level crypto operations * in the SDK instead. Further, you should probably never find yourself using this low-level crypto function. diff --git a/libs/common/src/key-management/crypto/services/web-crypto-function.service.spec.ts b/libs/common/src/key-management/crypto/services/web-crypto-function.service.spec.ts index c0b5150a720..d3ec4e11358 100644 --- a/libs/common/src/key-management/crypto/services/web-crypto-function.service.spec.ts +++ b/libs/common/src/key-management/crypto/services/web-crypto-function.service.spec.ts @@ -249,19 +249,6 @@ describe("WebCrypto Function Service", () => { }); }); - describe("rsaEncrypt", () => { - it("should successfully encrypt and then decrypt data", async () => { - const cryptoFunctionService = getWebCryptoFunctionService(); - const pubKey = Utils.fromB64ToArray(RsaPublicKey); - const privKey = Utils.fromB64ToArray(RsaPrivateKey); - const value = "EncryptMe!"; - const data = Utils.fromUtf8ToArray(value); - const encValue = new Uint8Array(await cryptoFunctionService.rsaEncrypt(data, pubKey, "sha1")); - const decValue = await cryptoFunctionService.rsaDecrypt(encValue, privKey, "sha1"); - expect(Utils.fromBufferToUtf8(decValue)).toBe(value); - }); - }); - describe("rsaDecrypt", () => { it("should successfully decrypt data", async () => { const cryptoFunctionService = getWebCryptoFunctionService(); diff --git a/libs/common/src/key-management/crypto/services/web-crypto-function.service.ts b/libs/common/src/key-management/crypto/services/web-crypto-function.service.ts index 175da716803..3e8f09b8970 100644 --- a/libs/common/src/key-management/crypto/services/web-crypto-function.service.ts +++ b/libs/common/src/key-management/crypto/services/web-crypto-function.service.ts @@ -256,22 +256,6 @@ export class WebCryptoFunctionService implements CryptoFunctionService { return new Uint8Array(buffer); } - async rsaEncrypt( - data: Uint8Array, - publicKey: Uint8Array, - algorithm: "sha1" | "sha256", - ): Promise { - // Note: Edge browser requires that we specify name and hash for both key import and decrypt. - // We cannot use the proper types here. - const rsaParams = { - name: "RSA-OAEP", - hash: { name: this.toWebCryptoAlgorithm(algorithm) }, - }; - const impKey = await this.subtle.importKey("spki", publicKey, rsaParams, false, ["encrypt"]); - const buffer = await this.subtle.encrypt(rsaParams, impKey, data); - return new Uint8Array(buffer); - } - async rsaDecrypt( data: Uint8Array, privateKey: Uint8Array,