1e1051a39Sopenharmony_ci#! /usr/bin/env perl
2e1051a39Sopenharmony_ci# Copyright 2015-2023 The OpenSSL Project Authors. All Rights Reserved.
3e1051a39Sopenharmony_ci#
4e1051a39Sopenharmony_ci# Licensed under the Apache License 2.0 (the "License").  You may not use
5e1051a39Sopenharmony_ci# this file except in compliance with the License.  You can obtain a copy
6e1051a39Sopenharmony_ci# in the file LICENSE in the source distribution or at
7e1051a39Sopenharmony_ci# https://www.openssl.org/source/license.html
8e1051a39Sopenharmony_ci
9e1051a39Sopenharmony_ci
10e1051a39Sopenharmony_ciuse strict;
11e1051a39Sopenharmony_ciuse warnings;
12e1051a39Sopenharmony_ci
13e1051a39Sopenharmony_ciuse File::Spec::Functions qw/canonpath/;
14e1051a39Sopenharmony_ciuse File::Copy;
15e1051a39Sopenharmony_ciuse OpenSSL::Test qw/:DEFAULT srctop_file bldtop_dir ok_nofips with/;
16e1051a39Sopenharmony_ciuse OpenSSL::Test::Utils;
17e1051a39Sopenharmony_ci
18e1051a39Sopenharmony_cisetup("test_verify");
19e1051a39Sopenharmony_ci
20e1051a39Sopenharmony_cisub verify {
21e1051a39Sopenharmony_ci    my ($cert, $purpose, $trusted, $untrusted, @opts) = @_;
22e1051a39Sopenharmony_ci    my @path = qw(test certs);
23e1051a39Sopenharmony_ci    my @args = qw(openssl verify -auth_level 1);
24e1051a39Sopenharmony_ci    push(@args, "-purpose", $purpose) if $purpose ne "";
25e1051a39Sopenharmony_ci    push(@args, @opts);
26e1051a39Sopenharmony_ci    for (@$trusted) { push(@args, "-trusted", srctop_file(@path, "$_.pem")) }
27e1051a39Sopenharmony_ci    for (@$untrusted) { push(@args, "-untrusted", srctop_file(@path, "$_.pem")) }
28e1051a39Sopenharmony_ci    push(@args, srctop_file(@path, "$cert.pem"));
29e1051a39Sopenharmony_ci    run(app([@args]));
30e1051a39Sopenharmony_ci}
31e1051a39Sopenharmony_ci
32e1051a39Sopenharmony_ciplan tests => 166;
33e1051a39Sopenharmony_ci
34e1051a39Sopenharmony_ci# Canonical success
35e1051a39Sopenharmony_ciok(verify("ee-cert", "sslserver", ["root-cert"], ["ca-cert"]),
36e1051a39Sopenharmony_ci   "accept compat trust");
37e1051a39Sopenharmony_ci
38e1051a39Sopenharmony_ci# Root CA variants
39e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(root-nonca)], [qw(ca-cert)]),
40e1051a39Sopenharmony_ci   "fail trusted non-ca root");
41e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(nroot+serverAuth)], [qw(ca-cert)]),
42e1051a39Sopenharmony_ci   "fail server trust non-ca root");
43e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(nroot+anyEKU)], [qw(ca-cert)]),
44e1051a39Sopenharmony_ci   "fail wildcard trust non-ca root");
45e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(root-cert2)], [qw(ca-cert)]),
46e1051a39Sopenharmony_ci   "fail wrong root key");
47e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(root-name2)], [qw(ca-cert)]),
48e1051a39Sopenharmony_ci   "fail wrong root DN");
49e1051a39Sopenharmony_ci
50e1051a39Sopenharmony_ci# Critical extensions
51e1051a39Sopenharmony_ci
52e1051a39Sopenharmony_ciok(verify("ee-cert-noncrit-unknown-ext", "", ["root-cert"], ["ca-cert"]),
53e1051a39Sopenharmony_ci   "accept non-critical unknown extension");
54e1051a39Sopenharmony_ciok(!verify("ee-cert-crit-unknown-ext", "", ["root-cert"], ["ca-cert"]),
55e1051a39Sopenharmony_ci   "reject critical unknown extension");
56e1051a39Sopenharmony_ciok(verify("ee-cert-ocsp-nocheck", "", ["root-cert"], ["ca-cert"]),
57e1051a39Sopenharmony_ci   "accept critical OCSP No Check");
58e1051a39Sopenharmony_ci
59e1051a39Sopenharmony_ci# Explicit trust/purpose combinations
60e1051a39Sopenharmony_ci#
61e1051a39Sopenharmony_ciok(verify("ee-cert", "sslserver", [qw(sroot-cert)], [qw(ca-cert)]),
62e1051a39Sopenharmony_ci   "accept server purpose");
63e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(croot-cert)], [qw(ca-cert)]),
64e1051a39Sopenharmony_ci   "fail client purpose");
65e1051a39Sopenharmony_ciok(verify("ee-cert", "sslserver", [qw(root+serverAuth)], [qw(ca-cert)]),
66e1051a39Sopenharmony_ci   "accept server trust");
67e1051a39Sopenharmony_ciok(verify("ee-cert", "sslserver", [qw(sroot+serverAuth)], [qw(ca-cert)]),
68e1051a39Sopenharmony_ci   "accept server trust with server purpose");
69e1051a39Sopenharmony_ciok(verify("ee-cert", "sslserver", [qw(croot+serverAuth)], [qw(ca-cert)]),
70e1051a39Sopenharmony_ci   "accept server trust with client purpose");
71e1051a39Sopenharmony_ci# Wildcard trust
72e1051a39Sopenharmony_ciok(verify("ee-cert", "sslserver", [qw(root+anyEKU)], [qw(ca-cert)]),
73e1051a39Sopenharmony_ci   "accept wildcard trust");
74e1051a39Sopenharmony_ciok(verify("ee-cert", "sslserver", [qw(sroot+anyEKU)], [qw(ca-cert)]),
75e1051a39Sopenharmony_ci   "accept wildcard trust with server purpose");
76e1051a39Sopenharmony_ciok(verify("ee-cert", "sslserver", [qw(croot+anyEKU)], [qw(ca-cert)]),
77e1051a39Sopenharmony_ci   "accept wildcard trust with client purpose");
78e1051a39Sopenharmony_ci# Inapplicable mistrust
79e1051a39Sopenharmony_ciok(verify("ee-cert", "sslserver", [qw(root-clientAuth)], [qw(ca-cert)]),
80e1051a39Sopenharmony_ci   "accept client mistrust");
81e1051a39Sopenharmony_ciok(verify("ee-cert", "sslserver", [qw(sroot-clientAuth)], [qw(ca-cert)]),
82e1051a39Sopenharmony_ci   "accept client mistrust with server purpose");
83e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(croot-clientAuth)], [qw(ca-cert)]),
84e1051a39Sopenharmony_ci   "fail client mistrust with client purpose");
85e1051a39Sopenharmony_ci# Inapplicable trust
86e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(root+clientAuth)], [qw(ca-cert)]),
87e1051a39Sopenharmony_ci   "fail client trust");
88e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(sroot+clientAuth)], [qw(ca-cert)]),
89e1051a39Sopenharmony_ci   "fail client trust with server purpose");
90e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(croot+clientAuth)], [qw(ca-cert)]),
91e1051a39Sopenharmony_ci   "fail client trust with client purpose");
92e1051a39Sopenharmony_ci# Server mistrust
93e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(root-serverAuth)], [qw(ca-cert)]),
94e1051a39Sopenharmony_ci   "fail rejected EKU");
95e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(sroot-serverAuth)], [qw(ca-cert)]),
96e1051a39Sopenharmony_ci   "fail server mistrust with server purpose");
97e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(croot-serverAuth)], [qw(ca-cert)]),
98e1051a39Sopenharmony_ci   "fail server mistrust with client purpose");
99e1051a39Sopenharmony_ci# Wildcard mistrust
100e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(root-anyEKU)], [qw(ca-cert)]),
101e1051a39Sopenharmony_ci   "fail wildcard mistrust");
102e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(sroot-anyEKU)], [qw(ca-cert)]),
103e1051a39Sopenharmony_ci   "fail wildcard mistrust with server purpose");
104e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(croot-anyEKU)], [qw(ca-cert)]),
105e1051a39Sopenharmony_ci   "fail wildcard mistrust with client purpose");
106e1051a39Sopenharmony_ci
107e1051a39Sopenharmony_ci# Check that trusted-first is on by setting up paths to different roots
108e1051a39Sopenharmony_ci# depending on whether the intermediate is the trusted or untrusted one.
109e1051a39Sopenharmony_ci#
110e1051a39Sopenharmony_ciok(verify("ee-cert", "sslserver", [qw(root-serverAuth root-cert2 ca-root2)],
111e1051a39Sopenharmony_ci          [qw(ca-cert)]),
112e1051a39Sopenharmony_ci   "accept trusted-first path");
113e1051a39Sopenharmony_ciok(verify("ee-cert", "sslserver", [qw(root-cert root2+serverAuth ca-root2)],
114e1051a39Sopenharmony_ci          [qw(ca-cert)]),
115e1051a39Sopenharmony_ci   "accept trusted-first path with server trust");
116e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(root-cert root2-serverAuth ca-root2)],
117e1051a39Sopenharmony_ci           [qw(ca-cert)]),
118e1051a39Sopenharmony_ci   "fail trusted-first path with server mistrust");
119e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(root-cert root2+clientAuth ca-root2)],
120e1051a39Sopenharmony_ci           [qw(ca-cert)]),
121e1051a39Sopenharmony_ci   "fail trusted-first path with client trust");
122e1051a39Sopenharmony_ci
123e1051a39Sopenharmony_ci# CA variants
124e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(root-cert)], [qw(ca-nonca)]),
125e1051a39Sopenharmony_ci   "fail non-CA untrusted intermediate");
126e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(root-cert)], [qw(ca-nonbc)]),
127e1051a39Sopenharmony_ci   "fail non-CA untrusted intermediate");
128e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(root-cert ca-nonca)], []),
129e1051a39Sopenharmony_ci   "fail non-CA trust-store intermediate");
130e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(root-cert ca-nonbc)], []),
131e1051a39Sopenharmony_ci   "fail non-CA trust-store intermediate");
132e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(root-cert nca+serverAuth)], []),
133e1051a39Sopenharmony_ci   "fail non-CA server trust intermediate");
134e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(root-cert nca+anyEKU)], []),
135e1051a39Sopenharmony_ci   "fail non-CA wildcard trust intermediate");
136e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(root-cert)], [qw(ca-cert2)]),
137e1051a39Sopenharmony_ci   "fail wrong intermediate CA key");
138e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(root-cert)], [qw(ca-name2)]),
139e1051a39Sopenharmony_ci   "fail wrong intermediate CA DN");
140e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(root-cert)], [qw(ca-root2)]),
141e1051a39Sopenharmony_ci   "fail wrong intermediate CA issuer");
142e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [], [qw(ca-cert)], "-partial_chain"),
143e1051a39Sopenharmony_ci   "fail untrusted partial chain");
144e1051a39Sopenharmony_ciok(verify("ee-cert", "sslserver", [qw(ca-cert)], [], "-partial_chain"),
145e1051a39Sopenharmony_ci   "accept trusted partial chain");
146e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(ca-expired)], [], "-partial_chain"),
147e1051a39Sopenharmony_ci   "reject expired trusted partial chain"); # this check is beyond RFC 5280
148e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(root-expired)], [qw(ca-cert)]),
149e1051a39Sopenharmony_ci   "reject expired trusted root"); # this check is beyond RFC 5280
150e1051a39Sopenharmony_ciok(verify("ee-cert", "sslserver", [qw(sca-cert)], [], "-partial_chain"),
151e1051a39Sopenharmony_ci   "accept partial chain with server purpose");
152e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(cca-cert)], [], "-partial_chain"),
153e1051a39Sopenharmony_ci   "fail partial chain with client purpose");
154e1051a39Sopenharmony_ciok(verify("ee-cert", "sslserver", [qw(ca+serverAuth)], [], "-partial_chain"),
155e1051a39Sopenharmony_ci   "accept server trust partial chain");
156e1051a39Sopenharmony_ciok(verify("ee-cert", "sslserver", [qw(cca+serverAuth)], [], "-partial_chain"),
157e1051a39Sopenharmony_ci   "accept server trust client purpose partial chain");
158e1051a39Sopenharmony_ciok(verify("ee-cert", "sslserver", [qw(ca-clientAuth)], [], "-partial_chain"),
159e1051a39Sopenharmony_ci   "accept client mistrust partial chain");
160e1051a39Sopenharmony_ciok(verify("ee-cert", "sslserver", [qw(ca+anyEKU)], [], "-partial_chain"),
161e1051a39Sopenharmony_ci   "accept wildcard trust partial chain");
162e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [], [qw(ca+serverAuth)], "-partial_chain"),
163e1051a39Sopenharmony_ci   "fail untrusted partial issuer with ignored server trust");
164e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(ca-serverAuth)], [], "-partial_chain"),
165e1051a39Sopenharmony_ci   "fail server mistrust partial chain");
166e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(ca+clientAuth)], [], "-partial_chain"),
167e1051a39Sopenharmony_ci   "fail client trust partial chain");
168e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(ca-anyEKU)], [], "-partial_chain"),
169e1051a39Sopenharmony_ci   "fail wildcard mistrust partial chain");
170e1051a39Sopenharmony_ci
171e1051a39Sopenharmony_ci# We now test auxiliary trust even for intermediate trusted certs without
172e1051a39Sopenharmony_ci# -partial_chain.  Note that "-trusted_first" is now always on and cannot
173e1051a39Sopenharmony_ci# be disabled.
174e1051a39Sopenharmony_ciok(verify("ee-cert", "sslserver", [qw(root-cert ca+serverAuth)], [qw(ca-cert)]),
175e1051a39Sopenharmony_ci   "accept server trust");
176e1051a39Sopenharmony_ciok(verify("ee-cert", "sslserver", [qw(root-cert ca+anyEKU)], [qw(ca-cert)]),
177e1051a39Sopenharmony_ci   "accept wildcard trust");
178e1051a39Sopenharmony_ciok(verify("ee-cert", "sslserver", [qw(root-cert sca-cert)], [qw(ca-cert)]),
179e1051a39Sopenharmony_ci   "accept server purpose");
180e1051a39Sopenharmony_ciok(verify("ee-cert", "sslserver", [qw(root-cert sca+serverAuth)], [qw(ca-cert)]),
181e1051a39Sopenharmony_ci   "accept server trust and purpose");
182e1051a39Sopenharmony_ciok(verify("ee-cert", "sslserver", [qw(root-cert sca+anyEKU)], [qw(ca-cert)]),
183e1051a39Sopenharmony_ci   "accept wildcard trust and server purpose");
184e1051a39Sopenharmony_ciok(verify("ee-cert", "sslserver", [qw(root-cert sca-clientAuth)], [qw(ca-cert)]),
185e1051a39Sopenharmony_ci   "accept client mistrust and server purpose");
186e1051a39Sopenharmony_ciok(verify("ee-cert", "sslserver", [qw(root-cert cca+serverAuth)], [qw(ca-cert)]),
187e1051a39Sopenharmony_ci   "accept server trust and client purpose");
188e1051a39Sopenharmony_ciok(verify("ee-cert", "sslserver", [qw(root-cert cca+anyEKU)], [qw(ca-cert)]),
189e1051a39Sopenharmony_ci   "accept wildcard trust and client purpose");
190e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(root-cert cca-cert)], [qw(ca-cert)]),
191e1051a39Sopenharmony_ci   "fail client purpose");
192e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(root-cert ca-anyEKU)], [qw(ca-cert)]),
193e1051a39Sopenharmony_ci   "fail wildcard mistrust");
194e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(root-cert ca-serverAuth)], [qw(ca-cert)]),
195e1051a39Sopenharmony_ci   "fail server mistrust");
196e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(root-cert ca+clientAuth)], [qw(ca-cert)]),
197e1051a39Sopenharmony_ci   "fail client trust");
198e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(root-cert sca+clientAuth)], [qw(ca-cert)]),
199e1051a39Sopenharmony_ci   "fail client trust and server purpose");
200e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(root-cert cca+clientAuth)], [qw(ca-cert)]),
201e1051a39Sopenharmony_ci   "fail client trust and client purpose");
202e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(root-cert cca-serverAuth)], [qw(ca-cert)]),
203e1051a39Sopenharmony_ci   "fail server mistrust and client purpose");
204e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(root-cert cca-clientAuth)], [qw(ca-cert)]),
205e1051a39Sopenharmony_ci   "fail client mistrust and client purpose");
206e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(root-cert sca-serverAuth)], [qw(ca-cert)]),
207e1051a39Sopenharmony_ci   "fail server mistrust and server purpose");
208e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(root-cert sca-anyEKU)], [qw(ca-cert)]),
209e1051a39Sopenharmony_ci   "fail wildcard mistrust and server purpose");
210e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(root-cert cca-anyEKU)], [qw(ca-cert)]),
211e1051a39Sopenharmony_ci   "fail wildcard mistrust and client purpose");
212e1051a39Sopenharmony_ci
213e1051a39Sopenharmony_ci# EE variants
214e1051a39Sopenharmony_ciok(verify("ee-client", "sslclient", [qw(root-cert)], [qw(ca-cert)]),
215e1051a39Sopenharmony_ci   "accept client chain");
216e1051a39Sopenharmony_ciok(!verify("ee-client", "sslserver", [qw(root-cert)], [qw(ca-cert)]),
217e1051a39Sopenharmony_ci   "fail server leaf purpose");
218e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslclient", [qw(root-cert)], [qw(ca-cert)]),
219e1051a39Sopenharmony_ci   "fail client leaf purpose");
220e1051a39Sopenharmony_ciok(!verify("ee-cert2", "sslserver", [qw(root-cert)], [qw(ca-cert)]),
221e1051a39Sopenharmony_ci   "fail wrong intermediate CA key");
222e1051a39Sopenharmony_ciok(!verify("ee-name2", "sslserver", [qw(root-cert)], [qw(ca-cert)]),
223e1051a39Sopenharmony_ci   "fail wrong intermediate CA DN");
224e1051a39Sopenharmony_ciok(!verify("ee-expired", "sslserver", [qw(root-cert)], [qw(ca-cert)]),
225e1051a39Sopenharmony_ci   "fail expired leaf");
226e1051a39Sopenharmony_ciok(verify("ee-cert", "sslserver", [qw(ee-cert)], [], "-partial_chain"),
227e1051a39Sopenharmony_ci   "accept last-resort direct leaf match");
228e1051a39Sopenharmony_ciok(verify("ee-client", "sslclient", [qw(ee-client)], [], "-partial_chain"),
229e1051a39Sopenharmony_ci   "accept last-resort direct leaf match");
230e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(ee-client)], [], "-partial_chain"),
231e1051a39Sopenharmony_ci   "fail last-resort direct leaf non-match");
232e1051a39Sopenharmony_ciok(verify("ee-cert", "sslserver", [qw(ee+serverAuth)], [], "-partial_chain"),
233e1051a39Sopenharmony_ci   "accept direct match with server trust");
234e1051a39Sopenharmony_ciok(!verify("ee-cert", "sslserver", [qw(ee-serverAuth)], [], "-partial_chain"),
235e1051a39Sopenharmony_ci   "fail direct match with server mistrust");
236e1051a39Sopenharmony_ciok(verify("ee-client", "sslclient", [qw(ee+clientAuth)], [], "-partial_chain"),
237e1051a39Sopenharmony_ci   "accept direct match with client trust");
238e1051a39Sopenharmony_ciok(!verify("ee-client", "sslclient", [qw(ee-clientAuth)], [], "-partial_chain"),
239e1051a39Sopenharmony_ci   "reject direct match with client mistrust");
240e1051a39Sopenharmony_ciok(verify("ee-pathlen", "sslserver", [qw(root-cert)], [qw(ca-cert)]),
241e1051a39Sopenharmony_ci   "accept non-ca with pathlen:0 by default");
242e1051a39Sopenharmony_ciok(!verify("ee-pathlen", "sslserver", [qw(root-cert)], [qw(ca-cert)], "-x509_strict"),
243e1051a39Sopenharmony_ci   "reject non-ca with pathlen:0 with strict flag");
244e1051a39Sopenharmony_ci
245e1051a39Sopenharmony_ci# Proxy certificates
246e1051a39Sopenharmony_ciok(!verify("pc1-cert", "sslclient", [qw(root-cert)], [qw(ee-client ca-cert)]),
247e1051a39Sopenharmony_ci   "fail to accept proxy cert without -allow_proxy_certs");
248e1051a39Sopenharmony_ciok(verify("pc1-cert", "sslclient", [qw(root-cert)], [qw(ee-client ca-cert)],
249e1051a39Sopenharmony_ci          "-allow_proxy_certs"),
250e1051a39Sopenharmony_ci   "accept proxy cert 1");
251e1051a39Sopenharmony_ciok(verify("pc2-cert", "sslclient", [qw(root-cert)], [qw(pc1-cert ee-client ca-cert)],
252e1051a39Sopenharmony_ci          "-allow_proxy_certs"),
253e1051a39Sopenharmony_ci   "accept proxy cert 2");
254e1051a39Sopenharmony_ciok(!verify("bad-pc3-cert", "sslclient", [qw(root-cert)], [qw(pc1-cert ee-client ca-cert)],
255e1051a39Sopenharmony_ci          "-allow_proxy_certs"),
256e1051a39Sopenharmony_ci   "fail proxy cert with incorrect subject");
257e1051a39Sopenharmony_ciok(!verify("bad-pc4-cert", "sslclient", [qw(root-cert)], [qw(pc1-cert ee-client ca-cert)],
258e1051a39Sopenharmony_ci          "-allow_proxy_certs"),
259e1051a39Sopenharmony_ci   "fail proxy cert with incorrect pathlen");
260e1051a39Sopenharmony_ciok(verify("pc5-cert", "sslclient", [qw(root-cert)], [qw(pc1-cert ee-client ca-cert)],
261e1051a39Sopenharmony_ci          "-allow_proxy_certs"),
262e1051a39Sopenharmony_ci   "accept proxy cert missing proxy policy");
263e1051a39Sopenharmony_ciok(!verify("pc6-cert", "sslclient", [qw(root-cert)], [qw(pc1-cert ee-client ca-cert)],
264e1051a39Sopenharmony_ci          "-allow_proxy_certs"),
265e1051a39Sopenharmony_ci   "failed proxy cert where last CN was added as a multivalue RDN component");
266e1051a39Sopenharmony_ci
267e1051a39Sopenharmony_ci# Security level tests
268e1051a39Sopenharmony_ciok(verify("ee-cert", "", ["root-cert"], ["ca-cert"], "-auth_level", "2"),
269e1051a39Sopenharmony_ci   "accept RSA 2048 chain at auth level 2");
270e1051a39Sopenharmony_ciok(!verify("ee-cert", "", ["root-cert"], ["ca-cert"], "-auth_level", "3"),
271e1051a39Sopenharmony_ci   "reject RSA 2048 root at auth level 3");
272e1051a39Sopenharmony_ciok(verify("ee-cert", "", ["root-cert-768"], ["ca-cert-768i"], "-auth_level", "0"),
273e1051a39Sopenharmony_ci   "accept RSA 768 root at auth level 0");
274e1051a39Sopenharmony_ciok(!verify("ee-cert", "", ["root-cert-768"], ["ca-cert-768i"]),
275e1051a39Sopenharmony_ci   "reject RSA 768 root at auth level 1");
276e1051a39Sopenharmony_ciok(verify("ee-cert-768i", "", ["root-cert"], ["ca-cert-768"], "-auth_level", "0"),
277e1051a39Sopenharmony_ci   "accept RSA 768 intermediate at auth level 0");
278e1051a39Sopenharmony_ciok(!verify("ee-cert-768i", "", ["root-cert"], ["ca-cert-768"]),
279e1051a39Sopenharmony_ci   "reject RSA 768 intermediate at auth level 1");
280e1051a39Sopenharmony_ciok(verify("ee-cert-768", "", ["root-cert"], ["ca-cert"], "-auth_level", "0"),
281e1051a39Sopenharmony_ci   "accept RSA 768 leaf at auth level 0");
282e1051a39Sopenharmony_ciok(!verify("ee-cert-768", "", ["root-cert"], ["ca-cert"]),
283e1051a39Sopenharmony_ci   "reject RSA 768 leaf at auth level 1");
284e1051a39Sopenharmony_ci#
285e1051a39Sopenharmony_ciok(verify("ee-cert", "", ["root-cert-md5"], ["ca-cert"], "-auth_level", "2"),
286e1051a39Sopenharmony_ci   "accept md5 self-signed TA at auth level 2");
287e1051a39Sopenharmony_ciok(verify("ee-cert", "", ["ca-cert-md5-any"], [], "-auth_level", "2"),
288e1051a39Sopenharmony_ci   "accept md5 intermediate TA at auth level 2");
289e1051a39Sopenharmony_ciok(verify("ee-cert", "", ["root-cert"], ["ca-cert-md5"], "-auth_level", "0"),
290e1051a39Sopenharmony_ci   "accept md5 intermediate at auth level 0");
291e1051a39Sopenharmony_ciok(!verify("ee-cert", "", ["root-cert"], ["ca-cert-md5"]),
292e1051a39Sopenharmony_ci   "reject md5 intermediate at auth level 1");
293e1051a39Sopenharmony_ciok(verify("ee-cert-md5", "", ["root-cert"], ["ca-cert"], "-auth_level", "0"),
294e1051a39Sopenharmony_ci   "accept md5 leaf at auth level 0");
295e1051a39Sopenharmony_ciok(!verify("ee-cert-md5", "", ["root-cert"], ["ca-cert"]),
296e1051a39Sopenharmony_ci   "reject md5 leaf at auth level 1");
297e1051a39Sopenharmony_ci
298e1051a39Sopenharmony_ci# Explicit vs named curve tests
299e1051a39Sopenharmony_ciSKIP: {
300e1051a39Sopenharmony_ci    skip "EC is not supported by this OpenSSL build", 3
301e1051a39Sopenharmony_ci        if disabled("ec");
302e1051a39Sopenharmony_ci    ok(!verify("ee-cert-ec-explicit", "", ["root-cert"],
303e1051a39Sopenharmony_ci               ["ca-cert-ec-named"]),
304e1051a39Sopenharmony_ci        "reject explicit curve leaf with named curve intermediate");
305e1051a39Sopenharmony_ci    ok(!verify("ee-cert-ec-named-explicit", "", ["root-cert"],
306e1051a39Sopenharmony_ci               ["ca-cert-ec-explicit"]),
307e1051a39Sopenharmony_ci        "reject named curve leaf with explicit curve intermediate");
308e1051a39Sopenharmony_ci    ok(verify("ee-cert-ec-named-named", "", ["root-cert"],
309e1051a39Sopenharmony_ci              ["ca-cert-ec-named"]),
310e1051a39Sopenharmony_ci        "accept named curve leaf with named curve intermediate");
311e1051a39Sopenharmony_ci}
312e1051a39Sopenharmony_ci# Same as above but with base provider used for decoding
313e1051a39Sopenharmony_ciSKIP: {
314e1051a39Sopenharmony_ci    my $no_fips = disabled('fips') || ($ENV{NO_FIPS} // 0);
315e1051a39Sopenharmony_ci    my $provconf = srctop_file("test", "fips-and-base.cnf");
316e1051a39Sopenharmony_ci    my $provpath = bldtop_dir("providers");
317e1051a39Sopenharmony_ci    my @prov = ("-provider-path", $provpath);
318e1051a39Sopenharmony_ci
319e1051a39Sopenharmony_ci    skip "EC is not supported or FIPS is disabled", 3
320e1051a39Sopenharmony_ci        if disabled("ec") || $no_fips;
321e1051a39Sopenharmony_ci
322e1051a39Sopenharmony_ci    run(test(["fips_version_test", "-config", $provconf, ">3.0.0"]),
323e1051a39Sopenharmony_ci             capture => 1, statusvar => \my $exit);
324e1051a39Sopenharmony_ci    skip "FIPS provider version is too old", 3
325e1051a39Sopenharmony_ci        if !$exit;
326e1051a39Sopenharmony_ci
327e1051a39Sopenharmony_ci    $ENV{OPENSSL_CONF} = $provconf;
328e1051a39Sopenharmony_ci
329e1051a39Sopenharmony_ci    ok(!verify("ee-cert-ec-explicit", "", ["root-cert"],
330e1051a39Sopenharmony_ci               ["ca-cert-ec-named"], @prov),
331e1051a39Sopenharmony_ci        "reject explicit curve leaf with named curve intermediate w/fips");
332e1051a39Sopenharmony_ci    ok(!verify("ee-cert-ec-named-explicit", "", ["root-cert"],
333e1051a39Sopenharmony_ci               ["ca-cert-ec-explicit"], @prov),
334e1051a39Sopenharmony_ci        "reject named curve leaf with explicit curve intermediate w/fips");
335e1051a39Sopenharmony_ci    ok(verify("ee-cert-ec-named-named", "", ["root-cert"],
336e1051a39Sopenharmony_ci              ["ca-cert-ec-named"], @prov),
337e1051a39Sopenharmony_ci        "accept named curve leaf with named curve intermediate w/fips");
338e1051a39Sopenharmony_ci
339e1051a39Sopenharmony_ci    delete $ENV{OPENSSL_CONF};
340e1051a39Sopenharmony_ci}
341e1051a39Sopenharmony_ci
342e1051a39Sopenharmony_ci# Depth tests, note the depth limit bounds the number of CA certificates
343e1051a39Sopenharmony_ci# between the trust-anchor and the leaf, so, for example, with a root->ca->leaf
344e1051a39Sopenharmony_ci# chain, depth = 1 is sufficient, but depth == 0 is not.
345e1051a39Sopenharmony_ci#
346e1051a39Sopenharmony_ciok(verify("ee-cert", "", ["root-cert"], ["ca-cert"], "-verify_depth", "2"),
347e1051a39Sopenharmony_ci   "accept chain with verify_depth 2");
348e1051a39Sopenharmony_ciok(verify("ee-cert", "", ["root-cert"], ["ca-cert"], "-verify_depth", "1"),
349e1051a39Sopenharmony_ci   "accept chain with verify_depth 1");
350e1051a39Sopenharmony_ciok(!verify("ee-cert", "", ["root-cert"], ["ca-cert"], "-verify_depth", "0"),
351e1051a39Sopenharmony_ci   "reject chain with verify_depth 0");
352e1051a39Sopenharmony_ciok(verify("ee-cert", "", ["ca-cert-md5-any"], [], "-verify_depth", "0"),
353e1051a39Sopenharmony_ci   "accept md5 intermediate TA with verify_depth 0");
354e1051a39Sopenharmony_ci
355e1051a39Sopenharmony_ci# Name Constraints tests.
356e1051a39Sopenharmony_ci
357e1051a39Sopenharmony_ciok(verify("alt1-cert", "", ["root-cert"], ["ncca1-cert"], ),
358e1051a39Sopenharmony_ci   "Name Constraints everything permitted");
359e1051a39Sopenharmony_ci
360e1051a39Sopenharmony_ciok(verify("alt2-cert", "", ["root-cert"], ["ncca2-cert"], ),
361e1051a39Sopenharmony_ci   "Name Constraints nothing excluded");
362e1051a39Sopenharmony_ci
363e1051a39Sopenharmony_ciok(verify("alt3-cert", "", ["root-cert"], ["ncca1-cert", "ncca3-cert"], ),
364e1051a39Sopenharmony_ci   "Name Constraints nested test all permitted");
365e1051a39Sopenharmony_ci
366e1051a39Sopenharmony_ciok(verify("goodcn1-cert", "", ["root-cert"], ["ncca1-cert"], ),
367e1051a39Sopenharmony_ci   "Name Constraints CNs permitted");
368e1051a39Sopenharmony_ci
369e1051a39Sopenharmony_ciok(verify("goodcn2-cert", "", ["root-cert"], ["ncca1-cert"], ),
370e1051a39Sopenharmony_ci   "Name Constraints CNs permitted - no SAN extension");
371e1051a39Sopenharmony_ci
372e1051a39Sopenharmony_ciok(!verify("badcn1-cert", "", ["root-cert"], ["ncca1-cert"], ),
373e1051a39Sopenharmony_ci   "Name Constraints CNs not permitted");
374e1051a39Sopenharmony_ci
375e1051a39Sopenharmony_ciok(!verify("badalt1-cert", "", ["root-cert"], ["ncca1-cert"], ),
376e1051a39Sopenharmony_ci   "Name Constraints hostname not permitted");
377e1051a39Sopenharmony_ci
378e1051a39Sopenharmony_ciok(!verify("badalt2-cert", "", ["root-cert"], ["ncca2-cert"], ),
379e1051a39Sopenharmony_ci   "Name Constraints hostname excluded");
380e1051a39Sopenharmony_ci
381e1051a39Sopenharmony_ciok(!verify("badalt3-cert", "", ["root-cert"], ["ncca1-cert"], ),
382e1051a39Sopenharmony_ci   "Name Constraints email address not permitted");
383e1051a39Sopenharmony_ci
384e1051a39Sopenharmony_ciok(!verify("badalt4-cert", "", ["root-cert"], ["ncca1-cert"], ),
385e1051a39Sopenharmony_ci   "Name Constraints subject email address not permitted");
386e1051a39Sopenharmony_ci
387e1051a39Sopenharmony_ciok(!verify("badalt5-cert", "", ["root-cert"], ["ncca1-cert"], ),
388e1051a39Sopenharmony_ci   "Name Constraints IP address not permitted");
389e1051a39Sopenharmony_ci
390e1051a39Sopenharmony_ciok(!verify("badalt6-cert", "", ["root-cert"], ["ncca1-cert"], ),
391e1051a39Sopenharmony_ci   "Name Constraints CN hostname not permitted");
392e1051a39Sopenharmony_ci
393e1051a39Sopenharmony_ciok(!verify("badalt7-cert", "", ["root-cert"], ["ncca1-cert"], ),
394e1051a39Sopenharmony_ci   "Name Constraints CN BMPSTRING hostname not permitted");
395e1051a39Sopenharmony_ci
396e1051a39Sopenharmony_ciok(!verify("badalt8-cert", "", ["root-cert"], ["ncca1-cert", "ncca3-cert"], ),
397e1051a39Sopenharmony_ci   "Name constraints nested DNS name not permitted 1");
398e1051a39Sopenharmony_ci
399e1051a39Sopenharmony_ciok(!verify("badalt9-cert", "", ["root-cert"], ["ncca1-cert", "ncca3-cert"], ),
400e1051a39Sopenharmony_ci   "Name constraints nested DNS name not permitted 2");
401e1051a39Sopenharmony_ci
402e1051a39Sopenharmony_ciok(!verify("badalt10-cert", "", ["root-cert"], ["ncca1-cert", "ncca3-cert"], ),
403e1051a39Sopenharmony_ci   "Name constraints nested DNS name excluded");
404e1051a39Sopenharmony_ci
405e1051a39Sopenharmony_ciok(!verify("bad-othername-cert", "", ["root-cert"], ["nccaothername-cert"], ),
406e1051a39Sopenharmony_ci   "CVE-2022-4203 type confusion test");
407e1051a39Sopenharmony_ci
408e1051a39Sopenharmony_ci#Check that we get the expected failure return code
409e1051a39Sopenharmony_ciwith({ exit_checker => sub { return shift == 2; } },
410e1051a39Sopenharmony_ci     sub {
411e1051a39Sopenharmony_ci         ok(verify("bad-othername-namec", "", ["bad-othername-namec-inter"], [],
412e1051a39Sopenharmony_ci                   "-partial_chain", "-attime", "1623060000"),
413e1051a39Sopenharmony_ci            "Name constraints bad othername name constraint");
414e1051a39Sopenharmony_ci     });
415e1051a39Sopenharmony_ci
416e1051a39Sopenharmony_ciok(verify("ee-pss-sha1-cert", "", ["root-cert"], ["ca-cert"], "-auth_level", "0"),
417e1051a39Sopenharmony_ci    "Accept PSS signature using SHA1 at auth level 0");
418e1051a39Sopenharmony_ci
419e1051a39Sopenharmony_ciok(verify("ee-pss-sha256-cert", "", ["root-cert"], ["ca-cert"], ),
420e1051a39Sopenharmony_ci    "CA with PSS signature using SHA256");
421e1051a39Sopenharmony_ci
422e1051a39Sopenharmony_ciok(!verify("ee-pss-sha1-cert", "", ["root-cert"], ["ca-cert"], "-auth_level", "1"),
423e1051a39Sopenharmony_ci    "Reject PSS signature using SHA1 and auth level 1");
424e1051a39Sopenharmony_ci
425e1051a39Sopenharmony_ciok(verify("ee-pss-sha256-cert", "", ["root-cert"], ["ca-cert"], "-auth_level", "2"),
426e1051a39Sopenharmony_ci    "PSS signature using SHA256 and auth level 2");
427e1051a39Sopenharmony_ci
428e1051a39Sopenharmony_ciok(verify("ee-pss-cert", "", ["root-cert"], ["ca-pss-cert"], ),
429e1051a39Sopenharmony_ci    "CA PSS signature");
430e1051a39Sopenharmony_ciok(!verify("ee-pss-wrong1.5-cert", "", ["root-cert"], ["ca-pss-cert"], ),
431e1051a39Sopenharmony_ci    "CA producing regular PKCS#1 v1.5 signature with PSA-PSS key");
432e1051a39Sopenharmony_ci
433e1051a39Sopenharmony_ciok(!verify("many-names1", "", ["many-constraints"], ["many-constraints"], ),
434e1051a39Sopenharmony_ci    "Too many names and constraints to check (1)");
435e1051a39Sopenharmony_ciok(!verify("many-names2", "", ["many-constraints"], ["many-constraints"], ),
436e1051a39Sopenharmony_ci    "Too many names and constraints to check (2)");
437e1051a39Sopenharmony_ciok(!verify("many-names3", "", ["many-constraints"], ["many-constraints"], ),
438e1051a39Sopenharmony_ci    "Too many names and constraints to check (3)");
439e1051a39Sopenharmony_ci
440e1051a39Sopenharmony_ciok(verify("some-names1", "", ["many-constraints"], ["many-constraints"], ),
441e1051a39Sopenharmony_ci    "Not too many names and constraints to check (1)");
442e1051a39Sopenharmony_ciok(verify("some-names2", "", ["many-constraints"], ["many-constraints"], ),
443e1051a39Sopenharmony_ci    "Not too many names and constraints to check (2)");
444e1051a39Sopenharmony_ciok(verify("some-names2", "", ["many-constraints"], ["many-constraints"], ),
445e1051a39Sopenharmony_ci    "Not too many names and constraints to check (3)");
446e1051a39Sopenharmony_ciok(verify("root-cert-rsa2", "", ["root-cert-rsa2"], [], "-check_ss_sig"),
447e1051a39Sopenharmony_ci    "Public Key Algorithm rsa instead of rsaEncryption");
448e1051a39Sopenharmony_ci
449e1051a39Sopenharmony_ciok(verify("ee-self-signed", "", ["ee-self-signed"], [], "-attime", "1593565200"),
450e1051a39Sopenharmony_ci   "accept trusted self-signed EE cert excluding key usage keyCertSign");
451e1051a39Sopenharmony_ciok(verify("ee-ss-with-keyCertSign", "", ["ee-ss-with-keyCertSign"], []),
452e1051a39Sopenharmony_ci   "accept trusted self-signed EE cert with key usage keyCertSign also when strict");
453e1051a39Sopenharmony_ci
454e1051a39Sopenharmony_ciSKIP: {
455e1051a39Sopenharmony_ci    skip "Ed25519 is not supported by this OpenSSL build", 6
456e1051a39Sopenharmony_ci        if disabled("ec");
457e1051a39Sopenharmony_ci
458e1051a39Sopenharmony_ci    # ED25519 certificate from draft-ietf-curdle-pkix-04
459e1051a39Sopenharmony_ci    ok(verify("ee-ed25519", "", ["root-ed25519"], []),
460e1051a39Sopenharmony_ci       "accept X25519 EE cert issued by trusted Ed25519 self-signed CA cert");
461e1051a39Sopenharmony_ci
462e1051a39Sopenharmony_ci    ok(!verify("ee-ed25519", "", ["root-ed25519"], [], "-x509_strict"),
463e1051a39Sopenharmony_ci       "reject X25519 EE cert in strict mode since AKID is missing");
464e1051a39Sopenharmony_ci
465e1051a39Sopenharmony_ci    ok(!verify("root-ed25519", "", ["ee-ed25519"], []),
466e1051a39Sopenharmony_ci       "fail Ed25519 CA and EE certs swapped");
467e1051a39Sopenharmony_ci
468e1051a39Sopenharmony_ci    ok(verify("root-ed25519", "", ["root-ed25519"], []),
469e1051a39Sopenharmony_ci       "accept trusted Ed25519 self-signed CA cert");
470e1051a39Sopenharmony_ci
471e1051a39Sopenharmony_ci    ok(!verify("ee-ed25519", "", ["ee-ed25519"], []),
472e1051a39Sopenharmony_ci       "fail trusted Ed25519-signed self-issued X25519 cert");
473e1051a39Sopenharmony_ci
474e1051a39Sopenharmony_ci    ok(verify("ee-ed25519", "", ["ee-ed25519"], [], "-partial_chain"),
475e1051a39Sopenharmony_ci       "accept last-resort direct leaf match Ed25519-signed self-issued cert");
476e1051a39Sopenharmony_ci
477e1051a39Sopenharmony_ci}
478e1051a39Sopenharmony_ci
479e1051a39Sopenharmony_ciSKIP: {
480e1051a39Sopenharmony_ci    skip "SM2 is not supported by this OpenSSL build", 2 if disabled("sm2");
481e1051a39Sopenharmony_ci
482e1051a39Sopenharmony_ci   ok_nofips(verify("sm2", "", ["sm2-ca-cert"], [], "-vfyopt", "distid:1234567812345678"),
483e1051a39Sopenharmony_ci       "SM2 ID test");
484e1051a39Sopenharmony_ci   ok_nofips(verify("sm2", "", ["sm2-ca-cert"], [], "-vfyopt", "hexdistid:31323334353637383132333435363738"),
485e1051a39Sopenharmony_ci       "SM2 hex ID test");
486e1051a39Sopenharmony_ci}
487e1051a39Sopenharmony_ci
488e1051a39Sopenharmony_ci# Mixed content tests
489e1051a39Sopenharmony_cimy $cert_file = srctop_file('test', 'certs', 'root-cert.pem');
490e1051a39Sopenharmony_cimy $rsa_file = srctop_file('test', 'certs', 'key-pass-12345.pem');
491e1051a39Sopenharmony_ci
492e1051a39Sopenharmony_ciSKIP: {
493e1051a39Sopenharmony_ci    my $certplusrsa_file = 'certplusrsa.pem';
494e1051a39Sopenharmony_ci    my $certplusrsa;
495e1051a39Sopenharmony_ci
496e1051a39Sopenharmony_ci    skip "Couldn't create certplusrsa.pem", 1
497e1051a39Sopenharmony_ci        unless ( open $certplusrsa, '>', $certplusrsa_file
498e1051a39Sopenharmony_ci                 and copy($cert_file, $certplusrsa)
499e1051a39Sopenharmony_ci                 and copy($rsa_file, $certplusrsa)
500e1051a39Sopenharmony_ci                 and close $certplusrsa );
501e1051a39Sopenharmony_ci
502e1051a39Sopenharmony_ci    ok(run(app([ qw(openssl verify -trusted), $certplusrsa_file, $cert_file ])),
503e1051a39Sopenharmony_ci       'Mixed cert + key file test');
504e1051a39Sopenharmony_ci}
505e1051a39Sopenharmony_ci
506e1051a39Sopenharmony_ciSKIP: {
507e1051a39Sopenharmony_ci    my $rsapluscert_file = 'rsapluscert.pem';
508e1051a39Sopenharmony_ci    my $rsapluscert;
509e1051a39Sopenharmony_ci
510e1051a39Sopenharmony_ci    skip "Couldn't create rsapluscert.pem", 1
511e1051a39Sopenharmony_ci        unless ( open $rsapluscert, '>', $rsapluscert_file
512e1051a39Sopenharmony_ci                 and copy($rsa_file, $rsapluscert)
513e1051a39Sopenharmony_ci                 and copy($cert_file, $rsapluscert)
514e1051a39Sopenharmony_ci                 and close $rsapluscert );
515e1051a39Sopenharmony_ci
516e1051a39Sopenharmony_ci    ok(run(app([ qw(openssl verify -trusted), $rsapluscert_file, $cert_file ])),
517e1051a39Sopenharmony_ci       'Mixed key + cert file test');
518e1051a39Sopenharmony_ci}
519e1051a39Sopenharmony_ci
520e1051a39Sopenharmony_ci# Certificate Policies
521e1051a39Sopenharmony_ciok(verify("ee-cert-policies", "", ["root-cert"], ["ca-pol-cert"],
522e1051a39Sopenharmony_ci          "-policy_check", "-policy", "1.3.6.1.4.1.16604.998855.1",
523e1051a39Sopenharmony_ci          "-explicit_policy"),
524e1051a39Sopenharmony_ci   "Certificate policy");
525e1051a39Sopenharmony_ci
526e1051a39Sopenharmony_ciok(!verify("ee-cert-policies-bad", "", ["root-cert"], ["ca-pol-cert"],
527e1051a39Sopenharmony_ci           "-policy_check", "-policy", "1.3.6.1.4.1.16604.998855.1",
528e1051a39Sopenharmony_ci           "-explicit_policy"),
529e1051a39Sopenharmony_ci   "Bad certificate policy");
530