CCF
Loading...
Searching...
No Matches
src
crypto
csr.h
Go to the documentation of this file.
1
// Copyright (c) Microsoft Corporation. All rights reserved.
2
// Licensed under the Apache 2.0 License.
3
#pragma once
4
5
#include "
ccf/crypto/openssl/openssl_wrappers.h
"
6
#include "
ccf/crypto/pem.h
"
7
8
#include <openssl/bio.h>
9
10
namespace
ccf::crypto
11
{
16
Pem
public_key_pem_from_csr
(
const
Pem
& signing_request)
17
{
18
X509* icrt = NULL;
19
OpenSSL::Unique_BIO
mem(signing_request);
20
OpenSSL::Unique_X509_REQ
csr(mem);
21
OpenSSL::Unique_BIO
buf;
22
23
EVP_PKEY* req_pubkey = X509_REQ_get0_pubkey(csr);
24
25
OpenSSL::CHECK1
(PEM_write_bio_PUBKEY(buf, req_pubkey));
26
27
BUF_MEM* bptr;
28
BIO_get_mem_ptr(buf, &bptr);
29
return
Pem
((uint8_t*)bptr->data, bptr->length);
30
}
31
}
ccf::crypto::Pem
Definition
pem.h:18
ccf::crypto::OpenSSL::CHECK1
void CHECK1(int rc)
Throws if rc is not 1 and has error.
Definition
openssl_wrappers.h:58
ccf::crypto
Definition
base64.h:10
ccf::crypto::public_key_pem_from_csr
Pem public_key_pem_from_csr(const Pem &signing_request)
Definition
csr.h:16
openssl_wrappers.h
pem.h
ccf::crypto::OpenSSL::Unique_BIO
Definition
openssl_wrappers.h:161
ccf::crypto::OpenSSL::Unique_X509_REQ
Definition
openssl_wrappers.h:236
Generated by
1.9.8