OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/crypto/rsa_private_key.h" | 5 #include </Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Security.fram
ework/Headers/cssmconfig.h> |
6 | 6 #include <stdbool.h> |
| 7 #include <string.h> |
| 8 #include <sys/types.h> |
7 #include <algorithm> | 9 #include <algorithm> |
8 #include <list> | 10 #include <list> |
| 11 #include <vector> |
9 | 12 |
| 13 #include "base/basictypes.h" |
| 14 #include "base/crypto/rsa_private_key.h" |
10 #include "base/logging.h" | 15 #include "base/logging.h" |
11 #include "base/scoped_ptr.h" | |
12 #include "base/string_util.h" | |
13 | 16 |
14 // This file manually encodes and decodes RSA private keys using PrivateKeyInfo | 17 // This file manually encodes and decodes RSA private keys using PrivateKeyInfo |
15 // from PKCS #8 and RSAPrivateKey from PKCS #1. These structures are: | 18 // from PKCS #8 and RSAPrivateKey from PKCS #1. These structures are: |
16 // | 19 // |
17 // PrivateKeyInfo ::= SEQUENCE { | 20 // PrivateKeyInfo ::= SEQUENCE { |
18 // version Version, | 21 // version Version, |
19 // privateKeyAlgorithm PrivateKeyAlgorithmIdentifier, | 22 // privateKeyAlgorithm PrivateKeyAlgorithmIdentifier, |
20 // privateKey PrivateKey, | 23 // privateKey PrivateKey, |
21 // attributes [0] IMPLICIT Attributes OPTIONAL | 24 // attributes [0] IMPLICIT Attributes OPTIONAL |
22 // } | 25 // } |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 // The version should be zero. | 374 // The version should be zero. |
372 for (uint32 i = 0; i < length; ++i) { | 375 for (uint32 i = 0; i < length; ++i) { |
373 READ_ASSERT(**pos == 0x00); | 376 READ_ASSERT(**pos == 0x00); |
374 (*pos)++; | 377 (*pos)++; |
375 } | 378 } |
376 | 379 |
377 return true; | 380 return true; |
378 } | 381 } |
379 | 382 |
380 } // namespace base | 383 } // namespace base |
OLD | NEW |