Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Unified Diff: third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h

Issue 1418113002: RTCPeerConnection.generateCertificate taking AlgorithmIdentifier and using WebCrypto (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.idl ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h
diff --git a/third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h b/third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h
index e90e98d466b11a6cea941a4d5b57e185cca118fa..bb3c80e6f389bfd026e0da963446b3ecd1e2a125 100644
--- a/third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h
+++ b/third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h
@@ -227,6 +227,23 @@ public:
const WebVector<unsigned char>& publicExponent() const { return m_publicExponent; }
const WebCryptoAlgorithm& hash() const { return m_hash; }
+ // Converts the public exponent (big-endian WebCrypto BigInteger), with or without leading zeros, to unsigned int. Returns true on success.
+ bool publicExponentToUint32(unsigned* result) const
eroman 2015/10/23 19:13:04 Blink style favors the use of references over out
hbos_chromium 2015/10/26 13:21:32 Done.
+ {
+ if (m_publicExponent.size() == 0)
eroman 2015/10/23 19:13:04 While you are editing things, can you delete these
hbos_chromium 2015/10/26 13:21:32 Done.
+ return false;
+
+ *result = 0;
+ for (size_t i = 0; i < m_publicExponent.size(); ++i) {
+ size_t iReversed = m_publicExponent.size() - i - 1;
+
+ if (iReversed >= sizeof(*result) && m_publicExponent[i])
+ return false; // Too large for a uint.
+
+ *result |= m_publicExponent[i] << 8 * iReversed;
+ }
+ return true;
+ }
private:
const unsigned m_modulusLengthBits;
const WebVector<unsigned char> m_publicExponent;
« no previous file with comments | « third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.idl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698