Please share c# code for encrypt Aadhar No using Cipher Type RSA/ECB/OAEPWithSHA256AndMGF1Padding.
Thank you for your response.
using https://www.devglan.com/online-tools/rsa-encryption-decryption i could do Encryption.
Is anyone Implemented this in c#. I have tried below code to encrypt, and if I pass that encrypted value to Payload, I’m getting response as Invalid LoginID
public static string encrptdata(string data)
{
String pubB64 = “MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAstWB95C5pHLXiYW59qyO4Xb+59KYVm9Hywbo77qETZVAyc6VIsxU+UWhd/k/YtjZibCznB+HaXWX9TVTFs9Nwgv7LRGq5uLczpZQDrU7dnGkl/urRA8p0Jv/f8T0MZdFWQgks91uFffeBmJOb58u68ZRxSYGMPe4hb9XXKDVsgoSJaRNYviH7RgAI2QhTCwLEiMqIaUX3p1SAc178ZlN8qHXSSGXvhDR1GKM+y2DIyJqlzfik7lD14mDY/I4lcbftib8cv7llkybtjX1AayfZp4XpmIXKWv8nRM488/jOAF81Bi13paKgpjQUUuwq9tb5Qd/DChytYgBTBTJFe7irDFCmTIcqPr8+IMB7tXA3YXPp3z605Z6cGoYxezUm2Nz2o6oUmarDUntDhq/PnkNergmSeSvS8gD9DHBuJkJWZweG3xOPXiKQAUBr92mdFhJGm6fitO5jsBxgpmulxpG0oKDy9lAOLWSqK92JMcbMNHn4wRikdI9HSiXrrI7fLhJYTbyU3I4v5ESdEsayHXuiwO/1C8y56egzKSw44GAtEpbAkTNEEfK5H5R0QnVBIXOvfeF4tzGvmkfOO6nNXU3o/WAdOyV3xSQ9dqLY5MEL4sJCGY1iJBIAQ452s8v0ynJG5Yq+8hNhsCVnklCzAlsIzQpnSVDUVEzv17grVAw078CAwEAAQ==”;
String text = data; // aadhaar no
byte[] EncryptedSymmetricKey;
byte[] textBytes = System.Text.Encoding.UTF8.GetBytes(text);
byte[] publicKeyBytes = System.Text.Encoding.UTF8.GetBytes(pubB64);// Convert.FromBase64String(pubB64);
// string s1 = Encoding.UTF8.GetString(publicKeyBytes);
var keyLengthBits = 1024;
RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
RSAParameters rsaKeyInfo = rsa.ExportParameters(false);
rsaKeyInfo.Modulus = publicKeyBytes;// modulus;
rsa.ImportParameters(rsaKeyInfo);
// EncryptedSymmetricKey = rsa.Encrypt(aes.Key, RSAEncryptionPadding.Pkcs1);
byte[] encrypted = rsa.Encrypt(textBytes, RSAEncryptionPadding.OaepSHA1);
return Convert.ToBase64String(encrypted);
}
@Remedinet try to remove all the regex may be this will help because i also faced these issue but when i remove the regex than it would working properly