• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_X509CRL_H
17 #define CF_X509CRL_H
18 
19 #include "cf_blob.h"
20 #include "crl.h"
21 #include "pub_key.h"
22 #include "x509_certificate.h"
23 #include "x509_crl_entry.h"
24 
25 typedef struct HcfX509Crl HcfX509Crl;
26 
27 struct HcfX509Crl {
28     /** HcfX509Crl inherit HcfCrl. */
29     HcfCrl base;
30 
31     /** Get the der coding format. */
32     CfResult (*getEncoded)(HcfX509Crl *self, CfEncodingBlob *encodedOut);
33 
34     /** Use the public key to verify the signature of CRL. */
35     CfResult (*verify)(HcfX509Crl *self, HcfPubKey *key);
36 
37     /** Get version number from CRL. */
38     long (*getVersion)(HcfX509Crl *self);
39 
40     /** Get the issuer name from CRL. Issuer means the entity that signs and publishes the CRL. */
41     CfResult (*getIssuerName)(HcfX509Crl *self, CfBlob *out);
42 
43     /** Get lastUpdate value from CRL. */
44     CfResult (*getLastUpdate)(HcfX509Crl *self, CfBlob *out);
45 
46     /** Get nextUpdate value from CRL. */
47     CfResult (*getNextUpdate)(HcfX509Crl *self, CfBlob *out);
48 
49     /** This method can be used to find CRL entries in indirect CRLs. */
50     CfResult (*getRevokedCert)(HcfX509Crl *self, long serialNumber, HcfX509CrlEntry **entryOut);
51 
52     /** This method can be used to find CRL entries in indirect cert. */
53     CfResult (*getRevokedCertWithCert)(HcfX509Crl *self, HcfX509Certificate *cert,
54         HcfX509CrlEntry **entryOut);
55 
56     /** Get all entries in this CRL. */
57     CfResult (*getRevokedCerts)(HcfX509Crl *self, CfArray *entrysOut);
58 
59     /** Get the CRL information encoded by Der from this CRL. */
60     CfResult (*getTbsInfo)(HcfX509Crl *self, CfBlob *tbsCertListOut);
61 
62     /** Get signature value from CRL. */
63     CfResult (*getSignature)(HcfX509Crl *self, CfBlob *signature);
64 
65     /** Get the signature algorithm name of the CRL signature algorithm. */
66     CfResult (*getSignatureAlgName)(HcfX509Crl *self, CfBlob *out);
67 
68     /** Get the signature algorithm oid string from CRL. */
69     CfResult (*getSignatureAlgOid)(HcfX509Crl *self, CfBlob *out);
70 
71     /** Get the der encoded signature algorithm parameters from the CRL signature algorithm. */
72     CfResult (*getSignatureAlgParams)(HcfX509Crl *self, CfBlob *sigAlgParamOut);
73 };
74 
75 #ifdef __cplusplus
76 extern "C" {
77 #endif
78 
79 CfResult HcfX509CrlCreate(const CfEncodingBlob *inStream, HcfX509Crl **returnObj);
80 
81 #ifdef __cplusplus
82 }
83 #endif
84 
85 #endif // CF_X509CRL_H