• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 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 HCF_X509CRL_H
17 #define HCF_X509CRL_H
18 
19 #include "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     HcfResult (*getEncoded)(HcfX509Crl *self, HcfEncodingBlob *encodedOut);
33 
34     /** Use the public key to verify the signature of CRL. */
35     HcfResult (*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     HcfResult (*getIssuerName)(HcfX509Crl *self, HcfBlob *out);
42 
43     /** Get lastUpdate value from CRL. */
44     HcfResult (*getLastUpdate)(HcfX509Crl *self, HcfBlob *out);
45 
46     /** Get nextUpdate value from CRL. */
47     HcfResult (*getNextUpdate)(HcfX509Crl *self, HcfBlob *out);
48 
49     /** This method can be used to find CRL entries in indirect CRLs. */
50     HcfResult (*getRevokedCert)(HcfX509Crl *self, long serialNumber, HcfX509CrlEntry **entryOut);
51 
52     /** This method can be used to find CRL entries in indirect cert. */
53     HcfResult (*getRevokedCertWithCert)(HcfX509Crl *self, HcfX509Certificate *cert,
54         HcfX509CrlEntry **entryOut);
55 
56     /** Get all entries in this CRL. */
57     HcfResult (*getRevokedCerts)(HcfX509Crl *self, HcfArray *entrysOut);
58 
59     /** Get the CRL information encoded by Der from this CRL. */
60     HcfResult (*getTbsInfo)(HcfX509Crl *self, HcfBlob *tbsCertListOut);
61 
62     /** Get signature value from CRL. */
63     HcfResult (*getSignature)(HcfX509Crl *self, HcfBlob *signature);
64 
65     /** Get the signature algorithm name of the CRL signature algorithm. */
66     HcfResult (*getSignatureAlgName)(HcfX509Crl *self, HcfBlob *out);
67 
68     /** Get the signature algorithm oid string from CRL. */
69     HcfResult (*getSignatureAlgOid)(HcfX509Crl *self, HcfBlob *out);
70 
71     /** Get the der encoded signature algorithm parameters from the CRL signature algorithm. */
72     HcfResult (*getSignatureAlgParams)(HcfX509Crl *self, HcfBlob *sigAlgParamOut);
73 };
74 
75 #ifdef __cplusplus
76 extern "C" {
77 #endif
78 
79 HcfResult HcfX509CrlCreate(const HcfEncodingBlob *inStream, HcfX509Crl **returnObj);
80 
81 #ifdef __cplusplus
82 }
83 #endif
84 
85 #endif // HCF_X509CRL_H