From 90a2847df7f4d9bb1e3ea5415d09f09568297274 Mon Sep 17 00:00:00 2001 From: "rafaelw@chromium.org" Date: Tue, 20 Oct 2009 20:39:52 +0000 Subject: Add a comment warning against using RSAPrivateKeyImport on untrusted sources. Review URL: http://codereview.chromium.org/307009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29566 0039d316-1c4b-4281-b951-d872f2087c98 --- base/crypto/rsa_private_key.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/base/crypto/rsa_private_key.h b/base/crypto/rsa_private_key.h index 5ce3839..7f562ec 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& input); // Accessors to the contents of the integer components of the PrivateKeyInfo @@ -74,7 +76,7 @@ class PrivateKeyInfoCodec { // value. void PrependInteger(const std::vector& in, std::list* out); void PrependInteger(uint8* val, int num_bytes, std::list* 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* out, + std::vector* out, bool big_endian); - + // Prepends the integer stored in |val|, starting a index |start|, for // |num_bytes| bytes onto |data|. void PrependBytes(uint8* val, -- cgit v1.1