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

Unified Diff: base/crypto/rsa_private_key.h

Issue 307009: Add a comment warning against using RSAPrivateKeyImport on untrusted sources. (Closed)
Patch Set: Created 11 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/crypto/rsa_private_key.h
diff --git a/base/crypto/rsa_private_key.h b/base/crypto/rsa_private_key.h
index 5ce38398531940217da6d3b76173a5418c90d6e9..7f562ecf76a59b8a34f877d799bf187a8b6622ac 100644
--- a/base/crypto/rsa_private_key.h
+++ b/base/crypto/rsa_private_key.h
@@ -39,7 +39,7 @@ class PrivateKeyInfoCodec {
static const uint8 kNullTag = 0x05;
static const uint8 kOctetStringTag = 0x04;
static const uint8 kSequenceTag = 0x30;
-
+
// |big_endian| here specifies the byte-significance of the integer components
// that will be parsed & serialized (modulus(), etc...) during Import(),
// Export() and ExportPublicKeyInfo() -- not the ASN.1 DER encoding of the
@@ -56,6 +56,8 @@ class PrivateKeyInfoCodec {
// Parses the ASN.1 DER encoding of the PrivateKeyInfo structure in |input|
// and populates the integer components with |big_endian_| byte-significance.
+ // IMPORTANT NOTE: This is currently *not* security-approved for importing
+ // keys from unstrusted sources.
bool Import(const std::vector<uint8>& input);
// Accessors to the contents of the integer components of the PrivateKeyInfo
@@ -74,7 +76,7 @@ class PrivateKeyInfoCodec {
// value.
void PrependInteger(const std::vector<uint8>& in, std::list<uint8>* out);
void PrependInteger(uint8* val, int num_bytes, std::list<uint8>* data);
-
+
// Prepends the integer stored in |val| - |val + num_bytes| with |big_endian|
// byte-significance into |data| as an ASN.1 integer.
void PrependIntegerImpl(uint8* val,
@@ -94,9 +96,9 @@ class PrivateKeyInfoCodec {
// |big_endian| byte-significance.
bool ReadIntegerImpl(uint8** pos,
uint8* end,
- std::vector<uint8>* out,
+ std::vector<uint8>* out,
bool big_endian);
-
+
// Prepends the integer stored in |val|, starting a index |start|, for
// |num_bytes| bytes onto |data|.
void PrependBytes(uint8* val,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698