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_X509_CRL_SPI_H
17 #define CF_X509_CRL_SPI_H
18 
19 #include "cf_blob.h"
20 #include "cf_object_base.h"
21 #include "cf_result.h"
22 #include "pub_key.h"
23 #include "x509_certificate.h"
24 #include "x509_crl_entry.h"
25 #include "x509_crl_match_parameters.h"
26 #include "x509_distinguished_name.h"
27 
28 typedef struct HcfX509CrlSpi HcfX509CrlSpi;
29 
30 struct HcfX509CrlSpi {
31     CfObjectBase base;
32 
33     const char *(*engineGetType)(HcfX509CrlSpi *self);
34 
35     bool (*engineIsRevoked)(HcfX509CrlSpi *self, const HcfCertificate *cert);
36 
37     CfResult (*engineGetEncoded)(HcfX509CrlSpi *self, CfEncodingBlob *encodedByte);
38 
39     CfResult (*engineVerify)(HcfX509CrlSpi *self, HcfPubKey *key);
40 
41     long (*engineGetVersion)(HcfX509CrlSpi *self);
42 
43     CfResult (*engineGetIssuerName)(HcfX509CrlSpi *self, CfBlob *out);
44 
45     CfResult (*engineGetLastUpdate)(HcfX509CrlSpi *self, CfBlob *out);
46 
47     CfResult (*engineGetNextUpdate)(HcfX509CrlSpi *self, CfBlob *out);
48 
49     CfResult (*engineGetRevokedCert)(HcfX509CrlSpi *self, const CfBlob *serialNumber, HcfX509CrlEntry **entryOut);
50 
51     CfResult (*engineGetRevokedCertWithCert)(HcfX509CrlSpi *self, HcfX509Certificate *cert,
52         HcfX509CrlEntry **entryOut);
53 
54     CfResult (*engineGetRevokedCerts)(HcfX509CrlSpi *self, CfArray *entrysOut);
55 
56     CfResult (*engineGetTbsInfo)(HcfX509CrlSpi *self, CfBlob *tbsCertListOut);
57 
58     CfResult (*engineGetSignature)(HcfX509CrlSpi *self, CfBlob *signature);
59 
60     CfResult (*engineGetSignatureAlgName)(HcfX509CrlSpi *self, CfBlob *out);
61 
62     CfResult (*engineGetSignatureAlgOid)(HcfX509CrlSpi *self, CfBlob *out);
63 
64     CfResult (*engineGetSignatureAlgParams)(HcfX509CrlSpi *self, CfBlob *sigAlgParamOut);
65 
66     CfResult (*engineGetExtensions)(HcfX509CrlSpi *self, CfBlob *out);
67 
68     CfResult (*engineMatch)(HcfX509CrlSpi *self, const HcfX509CrlMatchParams *matchParams, bool *out);
69 
70     CfResult (*engineToString)(HcfX509CrlSpi *self, CfBlob *out);
71 
72     CfResult (*engineHashCode)(HcfX509CrlSpi *self, CfBlob *out);
73 
74     CfResult (*engineGetExtensionsObject)(HcfX509CrlSpi *self, CfBlob *out);
75 };
76 
77 #endif // CF_X509_CRL_SPI_H
78