Index: content/renderer/webcrypto/webcrypto_util.cc |
diff --git a/content/renderer/webcrypto/webcrypto_util.cc b/content/renderer/webcrypto/webcrypto_util.cc |
index 3124afa7dfdf2594f575ba43149d29a155896d17..c74eebf63bb09858ffb109781ad845079061407a 100644 |
--- a/content/renderer/webcrypto/webcrypto_util.cc |
+++ b/content/renderer/webcrypto/webcrypto_util.cc |
@@ -107,6 +107,10 @@ Status Status::ErrorUnexpectedKeyType() { |
return Status("The key is not of the expected type"); |
} |
+Status Status::ErrorKeyAlgorithmMismatch() { |
+ return Status("The key's algorithm doesn't match that of operation"); |
+} |
+ |
Status Status::ErrorIncorrectSizeAesCbcIv() { |
return Status("The \"iv\" has an unexpected length -- must be 16 bytes"); |
} |
@@ -326,6 +330,14 @@ unsigned int ShaBlockSizeBytes(blink::WebCryptoAlgorithmId hash_id) { |
} |
} |
+bool IsAlgorithmAsymmetric(const blink::WebCryptoAlgorithm& algorithm) { |
+ // TODO(padolph): include all other asymmetric algorithms once they are |
+ // defined, e.g. EC and DH. |
+ return (algorithm.id() == blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5 || |
+ algorithm.id() == blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5 || |
+ algorithm.id() == blink::WebCryptoAlgorithmIdRsaOaep); |
+} |
+ |
} // namespace webcrypto |
} // namespace content |