1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *    http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef CF_CERTIFICATE_OEPNSSL_CLASS_H
17 #define CF_CERTIFICATE_OEPNSSL_CLASS_H
18 
19 #include "pub_key.h"
20 #include "pri_key.h"
21 #include "x509_certificate_spi.h"
22 #include "x509_crl_entry.h"
23 #include "x509_crl.h"
24 #include "x509_crl_spi.h"
25 
26 #include <openssl/bn.h>
27 #include <openssl/ec.h>
28 #include <openssl/evp.h>
29 #include <openssl/rsa.h>
30 #include <openssl/x509.h>
31 
32 typedef struct {
33     HcfPubKey base;
34 
35     uint32_t bits;
36 
37     RSA *pk;
38 } HcfOpensslRsaPubKey;
39 #define OPENSSL_RSA_PUBKEY_CLASS "OPENSSL.RSA.PUB_KEY"
40 
41 typedef struct {
42     HcfPriKey base;
43 
44     uint32_t bits;
45 
46     RSA *sk;
47 } HcfOpensslRsaPriKey;
48 #define OPENSSL_RSA_PRIKEY_CLASS "OPENSSL.RSA.PRI_KEY"
49 
50 typedef struct {
51     HcfX509CertificateSpi base;
52     X509 *x509;
53 } HcfOpensslX509Cert;
54 #define X509_CERT_OPENSSL_CLASS "X509CertOpensslClass"
55 
56 typedef struct {
57     HcfX509CrlEntry base;
58     X509_REVOKED *rev;
59     CfBlob *certIssuer;
60 } HcfX509CRLEntryOpensslImpl;
61 #define X509_CRL_ENTRY_OPENSSL_CLASS "X509CrlEntryOpensslClass"
62 
63 typedef struct {
64     HcfX509Crl base;
65     HcfX509CrlSpi *spiObj;
66     const char *certType;
67 } HcfX509CrlImpl;
68 #define X509_CRL_OPENSSL_CLASS "X509CrlOpensslClass"
69 
70 #endif
71