-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Offline QR validator #6
Comments
@dinsaw Can I pick this task up? |
Note : The doc is conflicting on the value of Mobile/Email Flag in 2 different places, The below description in 3.1 section is correct and the other reference later on in the doc is incorrect. 0, 1, 2, 3: 0 -no mobile/email. 1-Only email. 2-Only mobile.3 -Both email/mobile |
Additional Test case from UIDAI Website - Archive //Sumit Kumar With Photo, Email, Phone Mobile Email Flag is 3 |
There seem to be some issue with photograph / needs clarity. I was unable to extract photograph successfully as well on my java util. Noting here as getting struck in photograph extraction might not be your mistake. |
I am always getting false for any signature validation.Can anybody help please? My code is below:- byte[] encoded = Base64.decodeBase64("MIIHzzCCBregAwIBAgIEU5Sx5TANBgkqhkiG9w0BAQsFADCB/DELMAkGA1UEBhMCSU4xQTA/BgNVBAoTOEd1amFyYXQgTmFybWFkYSBWYWxsZXkgRmVydGlsaXplcnMgYW5kIENoZW1pY2FscyBMaW1pdGVkMR0wGwYDVQQLExRDZXJ0aWZ5aW5nIEF1dGhvcml0eTEPMA0GA1UEERMGMzgwMDU0MRAwDgYDVQQIEwdHdWphcmF0MSYwJAYDVQQJEx1Cb2Rha2RldiwgUyBHIFJvYWQsIEFobWVkYWJhZDEcMBoGA1UEMxMTMzAxLCBHTkZDIEluZm90b3dlcjEiMCAGA1UEAxMZKG4pQ29kZSBTb2x1dGlvbnMgQ0EgMjAxNDAeFw0xOTAzMTUwODQ0NDFaFw0yMTAyMjgxNzM0MzZaMIHpMQswCQYDVQQGEwJJTjExMC8GA1UEChMoVU5JUVVFIElERU5USUZJQ0FUSU9OIEFVVEhPUklUWSBPRiBJTkRJQTEPMA0GA1UEERMGMTEwMDAxMQ4wDAYDVQQIEwVEZWxoaTEnMCUGA1UECRMeQkVISU5EIEtBTEkgTUFORElSIEdPTE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GqCCARakggESMIIBDjELMAkGA1UEBhMCSU4xQTA/BgNVBAoTOEd1amFyYXQgTmFybWFkYSBWYWxsZXkgRmVydGlsaXplcnMgYW5kIENoZW1pY2FscyBMaW1pdGVkMR0wGwYDVQQLExRDZXJ0aWZ5aW5nIEF1dGhvcml0eTEPMA0GA1UEERMGMzgwMDU0MRAwDgYDVQQIEwdHdWphcmF0MSYwJAYDVQQJEx1Cb2Rha2RldiwgUyBHIFJvYWQsIEFobWVkYWJhZDEcMBoGA1UEMxMTMzAxLCBHTkZDIEluZm90b3dlcjEiMCAGA1UEAxMZKG4pQ29kZSBTb2x1dGlvbnMgQ0EgMjAxNDEQMA4GA1UEAxMHQ1JMNTUwODA9oDugOYY3aHR0cHM6Ly93d3cubmNvZGVzb2x1dGlvbnMuY29tL3JlcG9zaXRvcnkvbmNvZGVjYTE0LmNybDArBgNVHRAEJDAigA8yMDE5MDMxNTA4NDQ0MVqBDzIwMjEwMjI4MTczNDM2WjATBgNVHSMEDDAKgAhNB77xnp37vTAdBgNVHQ4EFgQUPVMv6SCRjsMNXoJoTys9LxJ2dDAwGQYJKoZIhvZ9B0EABAwwChsEVjguMQMCAygwDQYJKoZIhvcNAQELBQADggEBAJ378HWZ4HdVxMioDWNrWrnWi29DTOhEEGnBTLuKVBkgxT+MDJIdbDb6fXcPJH16BczZ6cauGKmRhkAb7/d74a/Vhro6mf9qMhbxMxE4/FgXQk4MSqhJR9+9u7sAXVEUu8UE3XPsl+NaBTRfha1hegypDSkmlBVMJH4uYNB09zRXPieO1CLYCMJExuZ18n0KJ7/QfrxNgcp9Hkwcib044PfvIXIzjU+O7LUlwk5x5jbVEtwECwPGyQV6O9OInh2Hd5PKhaNTJUCnoF6djlW8cf6eten7l21iBtFNAvKBfikmBOMZXe6cB+9ShOCOKz5zSzUwW+eZHSM43qCQ9G39img="); public boolean signvalidation(byte[] signature,byte[] signvalue, PublicKey pkey) throws NoSuchAlgorithmException, InvalidKeyException, SignatureException { |
boolean validsign = signvalidation(signbytes,sinvaluebyes,pkey); I don't know what the distinction between signbytes and sinvaluebyes. But signvalidation method is correct if signature is the dataBytes part and signvalue is signatureBytes and you update signature object with dataBytes first and verify using the signatureBytes. I was able to verify signature for few QR I had come across. The same in UIDAI site though is erroneous. |
@srikanthlogic .. This was the logic stated in the document. Is this logic correct? |
@srikanthlogic ... Can you please tell which public key are you using? Are you using the above public key? |
I was using uidai_prod_cdup.cer linked in the first comment on thread.
You are right, but I think reading backwards is only for photo (the thing I haven't been able to successfully extract yet) and signature is just last 256 bytes in unreversed order. Please do let us know if you are able to extract photo too successfully. |
@srikanthlogic Thank you so much... I am able to do signature validation now. But, photo I am still not able to extract |
Hi I am trying to validate signature in the secure QR code but I am getting false value. I used the above certificates and uidai_12_06_18_cer.cer. code of getting signature value__ signature verification method |
Utility functions for performing validation functions to validate Offline QR.
Reference - Archive
Download certificates for signature validation from UIDAI downloads page
Sample Unit Test Data for the given QR string in the reference
Content Length is : 1100
Data bytes is :185
Mobile Email Flag is 2
RefId is 890820190305150137123
Last 4 Digit of Aadhaar is 8908
Name is PENUMARTHI VENKAT
DOB is 07-05-1987
Gender is M
Address Care of is S/O: PATTABHI RAMA RAO
Address District is EAST GODAVARI
Address House is 4-83
Address location is SCTOR-2
Address PINCode is 533016
Address Post Office is ARATLAKATTA
Address State is ANDHRA PRADESH
Address Street is MAIN ROAD
Address SubDistrict is KARAPA
Address VTC is ARATLAKATTA
Data End is 184
Email Hash is null
Mobile Hash is 1F31F19AFC2BACBD8AFB84526AE4DA184A2727E8C2B1B6B9A81E4DC6B74D692A
Photo Exists : true
Signature Verify Data call is false
The text was updated successfully, but these errors were encountered: