From cdd57c6385a121229938cc7c8632772718c6ce23 Mon Sep 17 00:00:00 2001 From: Zhi Guan Date: Mon, 9 Jan 2023 18:33:17 +0800 Subject: [PATCH] Update X509 --- include/gmssl/x509.h | 6 +++++- src/x509_cer.c | 12 +++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/include/gmssl/x509.h b/include/gmssl/x509.h index 759f5991..342592e5 100644 --- a/include/gmssl/x509.h +++ b/include/gmssl/x509.h @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 The GmSSL Project. All Rights Reserved. + * Copyright 2014-2023 The GmSSL Project. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the License); you may * not use this file except in compliance with the License. @@ -327,6 +327,10 @@ int x509_certs_get_cert_by_index(const uint8_t *d, size_t dlen, int index, const int x509_certs_get_cert_by_subject(const uint8_t *d, size_t dlen, const uint8_t *subject, size_t subject_len, const uint8_t **cert, size_t *certlen); int x509_certs_get_last(const uint8_t *d, size_t dlen, const uint8_t **cert, size_t *certlen); +int x509_certs_get_cert_by_subject_and_key_identifier(const uint8_t *d, size_t dlen, + const uint8_t *subject, size_t subject_len, + const uint8_t *key_id, size_t key_id_len, + const uint8_t **cert, size_t *certlen); int x509_certs_get_cert_by_issuer_and_serial_number( const uint8_t *certs, size_t certs_len, const uint8_t *issuer, size_t issuer_len, diff --git a/src/x509_cer.c b/src/x509_cer.c index 72b54df8..f78ed867 100644 --- a/src/x509_cer.c +++ b/src/x509_cer.c @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 The GmSSL Project. All Rights Reserved. + * Copyright 2014-2023 The GmSSL Project. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the License); you may * not use this file except in compliance with the License. @@ -1442,6 +1442,16 @@ int x509_certs_get_cert_by_subject(const uint8_t *d, size_t dlen, return 0; } +int x509_certs_get_cert_by_subject_and_key_identifier(const uint8_t *d, size_t dlen, + const uint8_t *subject, size_t subject_len, + const uint8_t *key_id, size_t key_id_len, // AuthorityKeyIdentifier.keyIdentifier + const uint8_t **cert, size_t *certlen) +{ + // TODO: implement this + error_print(); + return -1; +} + int x509_certs_get_cert_by_issuer_and_serial_number( const uint8_t *certs, size_t certs_len, const uint8_t *issuer, size_t issuer_len,