diff options
author | Jack Lloyd <[email protected]> | 2015-10-14 16:32:17 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2015-10-14 16:32:17 -0400 |
commit | 39052451400dd9beb12c350d87c2d48ff476210e (patch) | |
tree | 0b0a87bcaf47c70e48df39808cd70c549d71668f /src/tests/unit_x509.cpp | |
parent | aad256035d4ecb9c4e87a7698f74f6f3178da0e2 (diff) |
Move DataSource to utils and rewrite PEM encoding to avoid filters
Removes filters as as an internal dependency pretty much entirely
(outside of some dusty corners in misc).
Diffstat (limited to 'src/tests/unit_x509.cpp')
-rw-r--r-- | src/tests/unit_x509.cpp | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/src/tests/unit_x509.cpp b/src/tests/unit_x509.cpp index f77be1992..2040e4bbf 100644 --- a/src/tests/unit_x509.cpp +++ b/src/tests/unit_x509.cpp @@ -11,7 +11,6 @@ #if defined(BOTAN_HAS_RSA) && defined(BOTAN_HAS_DSA) #include <botan/calendar.h> -#include <botan/filters.h> #include <botan/pkcs8.h> #include <botan/pkcs10.h> #include <botan/x509self.h> @@ -45,22 +44,12 @@ X509_Time from_date(const int y, const int m, const int d) u64bit key_id(const Public_Key* key) { - Pipe pipe(new Hash_Filter("SHA-1", 8)); - pipe.start_msg(); - pipe.write(key->algo_name()); - pipe.write(key->algorithm_identifier().parameters); - pipe.write(key->x509_subject_public_key()); - pipe.end_msg(); - - secure_vector<byte> output = pipe.read_all(); - - if(output.size() != 8) - throw Internal_Error("Public_Key::key_id: Incorrect output size"); - - u64bit id = 0; - for(u32bit j = 0; j != 8; ++j) - id = (id << 8) | output[j]; - return id; + std::unique_ptr<HashFunction> hash(HashFunction::create("SHA-1")); + hash->update(key->algo_name()); + hash->update(key->algorithm_identifier().parameters); + hash->update(key->x509_subject_public_key()); + secure_vector<byte> output = hash->final(); + return load_be<u64bit>(output.data()); } |