/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
nsString KeyAlgorithmProxy::JwkAlg() const { if (mName.EqualsLiteral(WEBCRYPTO_ALG_AES_CBC)) { switch (mAes.mLength) { case 128: return NS_LITERAL_STRING_FROM_CSTRING(JWK_ALG_A128CBC); case 192: return NS_LITERAL_STRING_FROM_CSTRING(JWK_ALG_A192CBC); case 256: return NS_LITERAL_STRING_FROM_CSTRING(JWK_ALG_A256CBC);
}
}
if (mName.EqualsLiteral(WEBCRYPTO_ALG_AES_CTR)) { switch (mAes.mLength) { case 128: return NS_LITERAL_STRING_FROM_CSTRING(JWK_ALG_A128CTR); case 192: return NS_LITERAL_STRING_FROM_CSTRING(JWK_ALG_A192CTR); case 256: return NS_LITERAL_STRING_FROM_CSTRING(JWK_ALG_A256CTR);
}
}
if (mName.EqualsLiteral(WEBCRYPTO_ALG_AES_GCM)) { switch (mAes.mLength) { case 128: return NS_LITERAL_STRING_FROM_CSTRING(JWK_ALG_A128GCM); case 192: return NS_LITERAL_STRING_FROM_CSTRING(JWK_ALG_A192GCM); case 256: return NS_LITERAL_STRING_FROM_CSTRING(JWK_ALG_A256GCM);
}
}
if (mName.EqualsLiteral(WEBCRYPTO_ALG_AES_KW)) { switch (mAes.mLength) { case 128: return NS_LITERAL_STRING_FROM_CSTRING(JWK_ALG_A128KW); case 192: return NS_LITERAL_STRING_FROM_CSTRING(JWK_ALG_A192KW); case 256: return NS_LITERAL_STRING_FROM_CSTRING(JWK_ALG_A256KW);
}
}
if (mName.EqualsLiteral(WEBCRYPTO_ALG_ECDSA)) {
nsString curveName = mEc.mNamedCurve; if (curveName.EqualsLiteral(WEBCRYPTO_NAMED_CURVE_P256)) { return NS_LITERAL_STRING_FROM_CSTRING(JWK_ALG_ECDSA_P_256);
} if (curveName.EqualsLiteral(WEBCRYPTO_NAMED_CURVE_P384)) { return NS_LITERAL_STRING_FROM_CSTRING(JWK_ALG_ECDSA_P_384);
} if (curveName.EqualsLiteral(WEBCRYPTO_NAMED_CURVE_P521)) { return NS_LITERAL_STRING_FROM_CSTRING(JWK_ALG_ECDSA_P_521);
}
}
return nsString();
}
CK_MECHANISM_TYPE
KeyAlgorithmProxy::GetMechanism(const KeyAlgorithm& aAlgorithm) { // For everything but HMAC, the name determines the mechanism // HMAC is handled by the specialization below return MapAlgorithmNameToMechanism(aAlgorithm.mName);
}
CK_MECHANISM_TYPE
KeyAlgorithmProxy::GetMechanism(const HmacKeyAlgorithm& aAlgorithm) { // The use of HmacKeyAlgorithm doesn't completely prevent this // method from being called with dictionaries that don't really // represent HMAC key algorithms.
MOZ_ASSERT(aAlgorithm.mName.EqualsLiteral(WEBCRYPTO_ALG_HMAC));
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.