use below code for oaepHash 256 in java Cipher cipher = Cipher.getInstance("RSA/ECB/OAEPPadding"); OAEPParameterSpec oaepParams =new OAEPParameterSpec("SHA-256", "MGF1", MGF1ParameterSpec.SHA256, PSource.PSpecified.DEFAULT); and it is same for node js configuration { key: privateKey, padding: crypto.constants.RSA_PKCS1_OAEP_PADDING, oaepHash: 'sha256', } as in node js same hash is used for mgf1 mask generation