Offline ekyc Sample data

Sample Data:

<OfflinePaperlessKyc referenceId="925020190122165455195">
<UidData>
<Poi dob="02-11-1995" e="076586c63449b7bd6be397...." gender="male" m="b6ecbb2c0f9b5678de8bce3bcd8155..." name="Madhu n"/>
<Poa country="#COUNTRY" dist="kozhikode" house="valanattu house update1" loc="malaparamba update1" pc="673009" po="malaparamba" state="32" street="malaparamba update1" subdist="005420" vtc="malaparamba"/>
<Pht>/9j/4AAQSkZJRgABAgAAAQABAAD.....</Pht>
</UidData>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo>
<CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<Reference URI="">
<Transforms>
<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
<DigestValue>WYqBFc...</DigestValue>
</Reference>
</SignedInfo>
<SignatureValue>fUledlM0faNmeJiDrZc2/...</SignatureValue>
<KeyInfo>
<X509Data>
<X509SubjectName>CN=hcl-aua,OU=hcl-aua...</X509SubjectName>
<X509Certificate>MIIDjTCCAnWgAwIBAgIEYhPg...</X509Certificate>
</X509Data>
</KeyInfo>
</Signature>
</OfflinePaperlessKyc>

This can be verified by using the below public key ekyc Public Key

string XMLFilePath = ""; //Get the XML file
string KeyFilePath = ""; //Get the public key certificate file
XmlDocument ObjXmlDocument = new XmlDocument();
ObjXmlDocument.Load(XMLFilePath); //Load the XML
XmlAttributeCollection SignatureElement = ObjXmlDocument.DocumentElement.Attributes; //Get the all XML attribute
string SignatureValue = SignatureElement.GetNamedItem("s").InnerXml; // Get Signature value
SignatureElement.RemoveNamedItem("s");//Remove the signature "s" attribute from XML and get the new XML to validate


/*----------------Read and parse the public key as string-----------------------*/
X509Certificate2 ObjX509Certificate2 = new X509Certificate2(KeyFilePath, "public"); //Initialize the public ket certificate file


Org.BouncyCastle.X509.X509Certificate objX509Certificate;
X509CertificateParser objX509CertificateParser = new X509CertificateParser();
objX509Certificate = objX509CertificateParser.ReadCertificate(ObjX509Certificate2.GetRawCertData());
/*----------------End-----------------------*/


/* Init alg */
ISigner signer = SignerUtilities.GetSigner("SHA256withRSA");


/* Populate key */
signer.Init(false, objX509Certificate.GetPublicKey());

/* Get the signature into bytes */
var expectedSig = Convert.FromBase64String(SignatureValue);


/* Get the bytes to be signed from the string */
var msgBytes = Encoding.UTF8.GetBytes(ObjXmlDocument.InnerXml);


/* Calculate the signature and see if it matches */
signer.BlockUpdate(msgBytes, 0, msgBytes.Length);
bool Flag = signer.VerifySignature(expectedSig);
if (Flag)
{
MessageBox.Show("XML Validate Successfully");
}
else
{
MessageBox.Show("XML Validation Failed");
}