-
-
Notifications
You must be signed in to change notification settings - Fork 158
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
Call MakeAssertionAsync() function and get error: " trailing garbage ". #268
Comments
I have not encountered this error myself, but it sounds like an encoding issue? |
Data formats are all over the place, but the signature is good. [Fact]
public void TestHoliday1228Data()
{
byte[] clientData = Convert.FromBase64String("eyJ0eXBlIjoid2ViYXV0aG4uZ2V0IiwiY2hhbGxlbmdlIjoiNUNqMjlid2tjOFhmckFSYVNabTVqUSIsIm9yaWdpbiI6Imh0dHBzOi8vcHR3ZG4wNC5wZWdhdHJvbmNvcnAuY29tOjQ0NDMiLCJjcm9zc09yaWdpbiI6ZmFsc2V9");
byte[] hashedClientDataJson = System.Security.Cryptography.SHA256.HashData(clientData);
byte[] sig = Convert.FromHexString("304402205cfa0302023a989a6f6d2a6693c2512bd7c2b99c45ab960f938d54670c24b95102200cdd2e17344814f3f4fecee3c3da1b7c42bcc1cf4cf7d40956e8df249c55e2a4");
byte[] ad = Base64Url.Decode("vBOPJxfou_mSSUwH_dHQftsCIU6COZhuxt6dw9e5PKgBAAAACA");
byte[] cpkBytes = Convert.FromBase64String("pQECAyYgASFYIBDiyG/IEegVjpEDRBFk/FlB1nQUalKXcnYL6U1DyoXuIlggYEZpTnxxF9AyAihWAvvv2GJbm3NW8/cu13+Eu1wKr5A=");
CredentialPublicKey cpk = new CredentialPublicKey(cpkBytes);
byte[] data = DataHelper.Concat(ad, hashedClientDataJson);
Assert.True(cpk.Verify(data, sig));
}
|
Update. |
Hi Sirs,
I implement a Web API services with version=2.0.2.0, but I meet a problem when I call MakeAssertionAsync() function in my code and always get error message " trailing garbage ".
I try to trace by myself and it seems with something wrong during verifying signature by public key.
I need some suggestions to resolve this problem for me, could you help?
The signature return from browser is
304402205cfa0302023a989a6f6d2a6693c2512bd7c2b99c45ab960f938d54670c24b95102200cdd2e17344814f3f4fecee3c3da1b7c42bcc1cf4cf7d40956e8df249c55e2a4
AuthenticatorData is
vBOPJxfou_mSSUwH_dHQftsCIU6COZhuxt6dw9e5PKgBAAAACA
ClientData is
eyJ0eXBlIjoid2ViYXV0aG4uZ2V0IiwiY2hhbGxlbmdlIjoiNUNqMjlid2tjOFhmckFSYVNabTVqUSIsIm9yaWdpbiI6Imh0dHBzOi8vcHR3ZG4wNC5wZWdhdHJvbmNvcnAuY29tOjQ0NDMiLCJjcm9zc09yaWdpbiI6ZmFsc2V9
Public key is
pQECAyYgASFYIBDiyG/IEegVjpEDRBFk/FlB1nQUalKXcnYL6U1DyoXuIlggYEZpTnxxF9AyAihWAvvv2GJbm3NW8/cu13+Eu1wKr5A=
The text was updated successfully, but these errors were encountered: