Bug 1392366 - WebAuthn must use the WebCrypto SHA-256 algorithm identifier r=keeler

WD-05 changed the "hashAlg" parameter of the CollectedClientData definition
from using an internally-defined "S256" string to identify the sha256 digest
to the definition in WebCrypto [1]. This only appears once, hard-coded in
WebAuthn (since U2F only supports SHA-256), so we need to change that one
instance.

[1] https://www.w3.org/TR/WebCryptoAPI/#sha-registration

MozReview-Commit-ID: 8de2CIGBBGA

--HG--
extra : rebase_source : e54c0d1f3f9551be48c3a72444edf62c45c647c4
This commit is contained in:
J.C. Jones 2017-08-21 12:06:15 -07:00
parent a3fa59a6a0
commit e5ca3874f4
2 changed files with 3 additions and 3 deletions

View File

@ -119,7 +119,7 @@ AssembleClientData(const nsAString& aOrigin, const CryptoBuffer& aChallenge,
CollectedClientData clientDataObject;
clientDataObject.mChallenge.Assign(challengeBase64);
clientDataObject.mOrigin.Assign(aOrigin);
clientDataObject.mHashAlg.Assign(NS_LITERAL_STRING("S256"));
clientDataObject.mHashAlg.Assign(NS_LITERAL_STRING("SHA-256"));
nsAutoString temp;
if (NS_WARN_IF(!clientDataObject.ToJSON(temp))) {

View File

@ -61,7 +61,7 @@ function() {
// WD-05 vs. WD-06: In WD-06, the second parameter should be "window.location.origin". Fix
// this in Bug 1384776
is(clientData.origin, document.domain, "Origin is correct");
is(clientData.hashAlg, "S256", "Hash algorithm is correct");
is(clientData.hashAlg, "SHA-256", "Hash algorithm is correct");
return webAuthnDecodeCBORAttestation(aCredInfo.response.attestationObject.buffer)
.then(function(decodedResult) {
@ -96,7 +96,7 @@ function() {
// WD-05 vs. WD-06: In WD-06, the second parameter should be "window.location.origin". Fix
// this in Bug 1384776
is(clientData.origin, document.domain, "Origin is correct");
is(clientData.hashAlg, "S256", "Hash algorithm is correct");
is(clientData.hashAlg, "SHA-256", "Hash algorithm is correct");
return webAuthnDecodeAttestation(aAssertion.response.authenticatorData)
.then(function(decodedResult) {