react-native-rsa-native icon indicating copy to clipboard operation
react-native-rsa-native copied to clipboard

[question] What encryption type is used?

Open davidcallanan opened this issue 5 years ago • 1 comments

What encryption type is used by this library? I would like to use RSA-PSS to match my webcrypto code:

await crypto.subtle.generateKey(
    {
      name: "RSA-PSS",
      hash: "SHA-256",
      modulusLength: 4096,
      publicExponent: new Uint8Array([1, 0, 1]),
    },
    true,
    ["sign", "verify"],
  );

davidcallanan avatar Aug 09 '20 10:08 davidcallanan

After digging in the Android and IOS code, it uses the RSA_PKCS1 according to RFC 3447 - section 7.2.

To change them, you must go into RSA.java and update the Algorithm in lines 132 and 154.

final Cipher cipher = Cipher.getInstance("RSA/NONE/PKCS1Padding");

A similar analysis can be done for IOS.

Saiid2001 avatar Mar 12 '23 16:03 Saiid2001