diff options
author | Jack Lloyd <[email protected]> | 2018-04-16 07:47:58 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-04-16 07:47:58 -0400 |
commit | 5a05ea6b00d672d521eabb4250dfbd997ff0700d (patch) | |
tree | 6941ad853f2fcb394f89bf0eb979c0f60c448dad /src/lib/x509/x509self.cpp | |
parent | 7398cea6fd7bfc1012a8b17a5034c095777195d6 (diff) |
Truncate new SKIDs to 192 bits
More than long enough, and saves quite a bit of space especially for
SHA-512 certificates.
Diffstat (limited to 'src/lib/x509/x509self.cpp')
-rw-r--r-- | src/lib/x509/x509self.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/lib/x509/x509self.cpp b/src/lib/x509/x509self.cpp index 78bbe8615..32f21c101 100644 --- a/src/lib/x509/x509self.cpp +++ b/src/lib/x509/x509self.cpp @@ -82,13 +82,10 @@ X509_Certificate create_self_signed_cert(const X509_Cert_Options& opts, extensions.add_new(new Cert_Extension::Key_Usage(constraints), true); } - std::unique_ptr<HashFunction> hash(HashFunction::create_or_throw(hash_fn)); - hash->update(pub_key); - std::vector<uint8_t> skid(hash->output_length()); - hash->final(skid.data()); + std::unique_ptr<Cert_Extension::Subject_Key_ID> skid(new Cert_Extension::Subject_Key_ID(pub_key, hash_fn)); - extensions.add_new(new Cert_Extension::Subject_Key_ID(skid)); - extensions.add_new(new Cert_Extension::Authority_Key_ID(skid)); + extensions.add_new(new Cert_Extension::Authority_Key_ID(skid->get_key_id())); + extensions.add_new(skid.release()); extensions.add_new( new Cert_Extension::Subject_Alternative_Name(subject_alt)); |