/* * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include "cm_test_log.h" #include "cm_test_common.h" #include "cert_manager_api.h" #include "cm_log.h" #include "cm_mem.h" using namespace testing::ext; using namespace CertmanagerTest; namespace { constexpr uint32_t MAX_URI_LEN = 256; static const uint8_t g_certData01[] = { /* 40dc992e.0 */ 0x30, 0x82, 0x04, 0x31, 0x30, 0x82, 0x03, 0x19, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x01, 0x00, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, 0x81, 0x95, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x47, 0x52, 0x31, 0x44, 0x30, 0x42, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x3b, 0x48, 0x65, 0x6c, 0x6c, 0x65, 0x6e, 0x69, 0x63, 0x20, 0x41, 0x63, 0x61, 0x64, 0x65, 0x6d, 0x69, 0x63, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x52, 0x65, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x20, 0x49, 0x6e, 0x73, 0x74, 0x69, 0x74, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x43, 0x65, 0x72, 0x74, 0x2e, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x31, 0x40, 0x30, 0x3e, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x37, 0x48, 0x65, 0x6c, 0x6c, 0x65, 0x6e, 0x69, 0x63, 0x20, 0x41, 0x63, 0x61, 0x64, 0x65, 0x6d, 0x69, 0x63, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x52, 0x65, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x20, 0x49, 0x6e, 0x73, 0x74, 0x69, 0x74, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x52, 0x6f, 0x6f, 0x74, 0x43, 0x41, 0x20, 0x32, 0x30, 0x31, 0x31, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x31, 0x31, 0x32, 0x30, 0x36, 0x31, 0x33, 0x34, 0x39, 0x35, 0x32, 0x5a, 0x17, 0x0d, 0x33, 0x31, 0x31, 0x32, 0x30, 0x31, 0x31, 0x33, 0x34, 0x39, 0x35, 0x32, 0x5a, 0x30, 0x81, 0x95, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x47, 0x52, 0x31, 0x44, 0x30, 0x42, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x3b, 0x48, 0x65, 0x6c, 0x6c, 0x65, 0x6e, 0x69, 0x63, 0x20, 0x41, 0x63, 0x61, 0x64, 0x65, 0x6d, 0x69, 0x63, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x52, 0x65, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x20, 0x49, 0x6e, 0x73, 0x74, 0x69, 0x74, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x43, 0x65, 0x72, 0x74, 0x2e, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x31, 0x40, 0x30, 0x3e, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x37, 0x48, 0x65, 0x6c, 0x6c, 0x65, 0x6e, 0x69, 0x63, 0x20, 0x41, 0x63, 0x61, 0x64, 0x65, 0x6d, 0x69, 0x63, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x52, 0x65, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x20, 0x49, 0x6e, 0x73, 0x74, 0x69, 0x74, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x52, 0x6f, 0x6f, 0x74, 0x43, 0x41, 0x20, 0x32, 0x30, 0x31, 0x31, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xa9, 0x53, 0x00, 0xe3, 0x2e, 0xa6, 0xf6, 0x8e, 0xfa, 0x60, 0xd8, 0x2d, 0x95, 0x3e, 0xf8, 0x2c, 0x2a, 0x54, 0x4e, 0xcd, 0xb9, 0x84, 0x61, 0x94, 0x58, 0x4f, 0x8f, 0x3d, 0x8b, 0xe4, 0x43, 0xf3, 0x75, 0x89, 0x8d, 0x51, 0xe4, 0xc3, 0x37, 0xd2, 0x8a, 0x88, 0x4d, 0x79, 0x1e, 0xb7, 0x12, 0xdd, 0x43, 0x78, 0x4a, 0x8a, 0x92, 0xe6, 0xd7, 0x48, 0xd5, 0x0f, 0xa4, 0x3a, 0x29, 0x44, 0x35, 0xb8, 0x07, 0xf6, 0x68, 0x1d, 0x55, 0xcd, 0x38, 0x51, 0xf0, 0x8c, 0x24, 0x31, 0x85, 0xaf, 0x83, 0xc9, 0x7d, 0xe9, 0x77, 0xaf, 0xed, 0x1a, 0x7b, 0x9d, 0x17, 0xf9, 0xb3, 0x9d, 0x38, 0x50, 0x0f, 0xa6, 0x5a, 0x79, 0x91, 0x80, 0xaf, 0x37, 0xae, 0xa6, 0xd3, 0x31, 0xfb, 0xb5, 0x26, 0x09, 0x9d, 0x3c, 0x5a, 0xef, 0x51, 0xc5, 0x2b, 0xdf, 0x96, 0x5d, 0xeb, 0x32, 0x1e, 0x02, 0xda, 0x70, 0x49, 0xec, 0x6e, 0x0c, 0xc8, 0x9a, 0x37, 0x8d, 0xf7, 0xf1, 0x36, 0x60, 0x4b, 0x26, 0x2c, 0x82, 0x9e, 0xd0, 0x78, 0xf3, 0x0d, 0x0f, 0x63, 0xa4, 0x51, 0x30, 0xe1, 0xf9, 0x2b, 0x27, 0x12, 0x07, 0xd8, 0xea, 0xbd, 0x18, 0x62, 0x98, 0xb0, 0x59, 0x37, 0x7d, 0xbe, 0xee, 0xf3, 0x20, 0x51, 0x42, 0x5a, 0x83, 0xef, 0x93, 0xba, 0x69, 0x15, 0xf1, 0x62, 0x9d, 0x9f, 0x99, 0x39, 0x82, 0xa1, 0xb7, 0x74, 0x2e, 0x8b, 0xd4, 0xc5, 0x0b, 0x7b, 0x2f, 0xf0, 0xc8, 0x0a, 0xda, 0x3d, 0x79, 0x0a, 0x9a, 0x93, 0x1c, 0xa5, 0x28, 0x72, 0x73, 0x91, 0x43, 0x9a, 0xa7, 0xd1, 0x4d, 0x85, 0x84, 0xb9, 0xa9, 0x74, 0x8f, 0x14, 0x40, 0xc7, 0xdc, 0xde, 0xac, 0x41, 0x64, 0x6c, 0xb4, 0x19, 0x9b, 0x02, 0x63, 0x6d, 0x24, 0x64, 0x8f, 0x44, 0xb2, 0x25, 0xea, 0xce, 0x5d, 0x74, 0x0c, 0x63, 0x32, 0x5c, 0x8d, 0x87, 0xe5, 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, 0x81, 0x89, 0x30, 0x81, 0x86, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xff, 0x30, 0x0b, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x04, 0x04, 0x03, 0x02, 0x01, 0x06, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0xa6, 0x91, 0x42, 0xfd, 0x13, 0x61, 0x4a, 0x23, 0x9e, 0x08, 0xa4, 0x29, 0xe5, 0xd8, 0x13, 0x04, 0x23, 0xee, 0x41, 0x25, 0x30, 0x47, 0x06, 0x03, 0x55, 0x1d, 0x1e, 0x04, 0x40, 0x30, 0x3e, 0xa0, 0x3c, 0x30, 0x05, 0x82, 0x03, 0x2e, 0x67, 0x72, 0x30, 0x05, 0x82, 0x03, 0x2e, 0x65, 0x75, 0x30, 0x06, 0x82, 0x04, 0x2e, 0x65, 0x64, 0x75, 0x30, 0x06, 0x82, 0x04, 0x2e, 0x6f, 0x72, 0x67, 0x30, 0x05, 0x81, 0x03, 0x2e, 0x67, 0x72, 0x30, 0x05, 0x81, 0x03, 0x2e, 0x65, 0x75, 0x30, 0x06, 0x81, 0x04, 0x2e, 0x65, 0x64, 0x75, 0x30, 0x06, 0x81, 0x04, 0x2e, 0x6f, 0x72, 0x67, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x1f, 0xef, 0x79, 0x41, 0xe1, 0x7b, 0x6e, 0x3f, 0xb2, 0x8c, 0x86, 0x37, 0x42, 0x4a, 0x4e, 0x1c, 0x37, 0x1e, 0x8d, 0x66, 0xba, 0x24, 0x81, 0xc9, 0x4f, 0x12, 0x0f, 0x21, 0xc0, 0x03, 0x97, 0x86, 0x25, 0x6d, 0x5d, 0xd3, 0x22, 0x29, 0xa8, 0x6c, 0xa2, 0x0d, 0xa9, 0xeb, 0x3d, 0x06, 0x5b, 0x99, 0x3a, 0xc7, 0xcc, 0xc3, 0x9a, 0x34, 0x7f, 0xab, 0x0e, 0xc8, 0x4e, 0x1c, 0xe1, 0xfa, 0xe4, 0xdc, 0xcd, 0x0d, 0xbe, 0xbf, 0x24, 0xfe, 0x6c, 0xe7, 0x6b, 0xc2, 0x0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certData02[] = { /* 985c1f52.0 */ 0x30, 0x82, 0x05, 0x83, 0x30, 0x82, 0x03, 0x6b, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x0e, 0x45, 0xe6, 0xbb, 0x03, 0x83, 0x33, 0xc3, 0x85, 0x65, 0x48, 0xe6, 0xff, 0x45, 0x51, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0c, 0x05, 0x00, 0x30, 0x4c, 0x31, 0x20, 0x30, 0x1e, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x13, 0x17, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x53, 0x69, 0x67, 0x6e, 0x20, 0x52, 0x6f, 0x6f, 0x74, 0x20, 0x43, 0x41, 0x20, 0x2d, 0x20, 0x52, 0x36, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x0a, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x53, 0x69, 0x67, 0x6e, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x0a, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x53, 0x69, 0x67, 0x6e, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x34, 0x31, 0x32, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x17, 0x0d, 0x33, 0x34, 0x31, 0x32, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x30, 0x4c, 0x31, 0x20, 0x30, 0x1e, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x13, 0x17, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x53, 0x69, 0x67, 0x6e, 0x20, 0x52, 0x6f, 0x6f, 0x74, 0x20, 0x43, 0x41, 0x20, 0x2d, 0x20, 0x52, 0x36, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x0a, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x53, 0x69, 0x67, 0x6e, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x0a, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x53, 0x69, 0x67, 0x6e, 0x30, 0x82, 0x02, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x02, 0x0f, 0x00, 0x30, 0x82, 0x02, 0x0a, 0x02, 0x82, 0x02, 0x01, 0x00, 0x95, 0x07, 0xe8, 0x73, 0xca, 0x66, 0xf9, 0xec, 0x14, 0xca, 0x7b, 0x3c, 0xf7, 0x0d, 0x08, 0xf1, 0xb4, 0x45, 0x0b, 0x2c, 0x82, 0xb4, 0x48, 0xc6, 0xeb, 0x5b, 0x3c, 0xae, 0x83, 0xb8, 0x41, 0x92, 0x33, 0x14, 0xa4, 0x6f, 0x7f, 0xe9, 0x2a, 0xcc, 0xc6, 0xb0, 0x88, 0x6b, 0xc5, 0xb6, 0x89, 0xd1, 0xc6, 0xb2, 0xff, 0x14, 0xce, 0x51, 0x14, 0x21, 0xec, 0x4a, 0xdd, 0x1b, 0x5a, 0xc6, 0xd6, 0x87, 0xee, 0x4d, 0x3a, 0x15, 0x06, 0xed, 0x64, 0x66, 0x0b, 0x92, 0x80, 0xca, 0x44, 0xde, 0x73, 0x94, 0x4e, 0xf3, 0xa7, 0x89, 0x7f, 0x4f, 0x78, 0x63, 0x08, 0xc8, 0x12, 0x50, 0x6d, 0x42, 0x66, 0x2f, 0x4d, 0xb9, 0x79, 0x28, 0x4d, 0x52, 0x1a, 0x8a, 0x1a, 0x80, 0xb7, 0x19, 0x81, 0x0e, 0x7e, 0xc4, 0x8a, 0xbc, 0x64, 0x4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, 0x11, 0xb5, 0x84, 0x14, 0x8a, 0x00, 0x19, 0x70, 0x83, 0x79, 0x91, 0x97, 0x91, 0xd4, 0x1a, 0x27, 0xbf, 0x37, 0x1e, 0x32, 0x07, 0xd8, 0x14, 0x63, 0x3c, 0x28, 0x4c, 0xaf, 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, 0x63, 0x30, 0x61, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03, 0x02, 0x01, 0x06, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xff, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0xae, 0x6c, 0x05, 0xa3, 0x93, 0x13, 0xe2, 0xa2, 0xe7, 0xe2, 0xd7, 0x1c, 0xd6, 0xc7, 0xf0, 0x7f, 0xc8, 0x67, 0x53, 0xa0, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0xae, 0x6c, 0x05, 0xa3, 0x93, 0x13, 0xe2, 0xa2, 0xe7, 0xe2, 0xd7, 0x1c, 0xd6, 0xc7, 0xf0, 0x7f, 0xc8, 0x67, 0x53, 0xa0, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0c, 0x05, 0x00, 0x03, 0x82, 0x02, 0x01, 0x00, 0x83, 0x25, 0xed, 0xe8, 0xd1, 0xfd, 0x95, 0x52, 0xcd, 0x9e, 0xc0, 0x04, 0xa0, 0x91, 0x69, 0xe6, 0x5c, 0xd0, 0x84, 0xde, 0xdc, 0xad, 0xa2, 0x4f, 0xe8, 0x47, 0x78, 0xd6, 0x65, 0x98, 0xa9, 0x5b, 0xa8, 0x3c, 0x87, 0x7c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7c, 0x8b, 0x4a, 0xa1, 0x90, 0x74, 0x25, 0xa7, 0xb3, 0x3e, 0x4b, 0xc8, 0x2c, 0x56, 0xbd, 0xc7, 0xc8, 0xef, 0x38, 0xe2, 0x5c, 0x92, 0xf0, 0x79, 0xf7, 0x9c, 0x84, 0xba, 0x74, 0x2d, 0x61, 0x01, 0x20, 0x7e, 0x7e, 0xd1, 0xf2, 0x4f, 0x07, 0x59, 0x5f, 0x8b, 0x2d, 0x43, 0x52, 0xeb, 0x46, 0x0c, 0x94, 0xe1, 0xf5, 0x66, 0x47, 0x79, 0x77, 0xd5, 0x54, 0x5b, 0x1f, 0xad, 0x24, 0x37, 0xcb, 0x45, 0x5a, 0x4e, 0xa0, 0x44, 0x48, 0xc8, 0xd8, 0xb0, 0x99, 0xc5, 0x15, 0x84, 0x09, 0xf6, 0xd6, 0x49, 0x49, 0xc0, 0x65, 0xb8, 0xe6, 0x1a, 0x71, 0x6e, 0xa0, 0xa8, 0xf1, 0x82, 0xe8, 0x45, 0x3e, 0x6c, 0xd6, 0x02, 0xd7, 0x0a, 0x67, 0x83, 0x05, 0x5a, 0xc9, 0xa4, 0x10 }; static const uint8_t g_certData03[] = { /* 1df5a75f.0 */ 0x30, 0x82, 0x04, 0x33, 0x30, 0x82, 0x03, 0x1b, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x03, 0x09, 0x83, 0xf3, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x30, 0x4d, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x44, 0x45, 0x31, 0x15, 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x0c, 0x44, 0x2d, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x47, 0x6d, 0x62, 0x48, 0x31, 0x27, 0x30, 0x25, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x1e, 0x44, 0x2d, 0x54, 0x52, 0x55, 0x53, 0x54, 0x20, 0x52, 0x6f, 0x6f, 0x74, 0x20, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x20, 0x33, 0x20, 0x43, 0x41, 0x20, 0x32, 0x20, 0x32, 0x30, 0x30, 0x39, 0x30, 0x1e, 0x17, 0x0d, 0x30, 0x39, 0x31, 0x31, 0x30, 0x35, 0x30, 0x38, 0x33, 0x35, 0x35, 0x38, 0x5a, 0x17, 0x0d, 0x32, 0x39, 0x31, 0x31, 0x30, 0x35, 0x30, 0x38, 0x33, 0x35, 0x35, 0x38, 0x5a, 0x30, 0x4d, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x44, 0x45, 0x31, 0x15, 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x0c, 0x44, 0x2d, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x47, 0x6d, 0x62, 0x48, 0x31, 0x27, 0x30, 0x25, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x1e, 0x44, 0x2d, 0x54, 0x52, 0x55, 0x53, 0x54, 0x20, 0x52, 0x6f, 0x6f, 0x74, 0x20, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x20, 0x33, 0x20, 0x43, 0x41, 0x20, 0x32, 0x20, 0x32, 0x30, 0x30, 0x39, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xd3, 0xb2, 0x4a, 0xcf, 0x7a, 0x47, 0xef, 0x75, 0x9b, 0x23, 0xfa, 0x3a, 0x2f, 0xd6, 0x50, 0x45, 0x89, 0x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0x67, 0x52, 0xab, 0x95, 0x1f, 0xe0, 0x46, 0x3e, 0xd8, 0xa4, 0xc3, 0xca, 0x5a, 0xc5, 0x31, 0x80, 0xe8, 0x48, 0x9a, 0x9f, 0x94, 0x69, 0xfe, 0x19, 0xdd, 0xd8, 0x73, 0x7c, 0x81, 0xca, 0x96, 0xde, 0x8e, 0xed, 0xb3, 0x32, 0x05, 0x65, 0x84, 0x34, 0xe6, 0xe6, 0xfd, 0x57, 0x10, 0xb5, 0x5f, 0x76, 0xbf, 0x2f, 0xb0, 0x10, 0x0d, 0xc5, 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, 0x82, 0x01, 0x1a, 0x30, 0x82, 0x01, 0x16, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xff, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0xfd, 0xda, 0x14, 0xc4, 0x9f, 0x30, 0xde, 0x21, 0xbd, 0x1e, 0x42, 0x39, 0xfc, 0xab, 0x63, 0x23, 0x49, 0xe0, 0xf1, 0x84, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03, 0x02, 0x01, 0x06, 0x30, 0x81, 0xd3, 0x06, 0x03, 0x55, 0x1d, 0x1f, 0x04, 0x81, 0xcb, 0x30, 0x81, 0xc8, 0x30, 0x81, 0x80, 0xa0, 0x7e, 0xa0, 0x7c, 0x86, 0x7a, 0x6c, 0x64, 0x61, 0x70, 0x3a, 0x2f, 0x2f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x64, 0x2d, 0x74, 0x72, 0x75, 0x73, 0x74, 0x2e, 0x6e, 0x65, 0x74, 0x2f, 0x43, 0x4e, 0x3d, 0x44, 0x2d, 0x54, 0x52, 0x55, 0x53, 0x54, 0x25, 0x32, 0x30, 0x52, 0x6f, 0x6f, 0x74, 0x25, 0x32, 0x30, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x25, 0x32, 0x30, 0x33, 0x25, 0x32, 0x30, 0x43, 0x41, 0x25, 0x32, 0x30, 0x32, 0x25, 0x32, 0x30, 0x32, 0x30, 0x30, 0x39, 0x2c, 0x4f, 0x3d, 0x44, 0x2d, 0x54, 0x72, 0x75, 0x73, 0x74, 0x25, 0x32, 0x30, 0x47, 0x6d, 0x62, 0x48, 0x2c, 0x43, 0x3d, 0x44, 0x45, 0x3f, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x72, 0x65, 0x76, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x6c, 0x69, 0x73, 0x74, 0x30, 0x43, 0xa0, 0x41, 0xa0, 0x3f, 0x86, 0x3d, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x64, 0x2d, 0x74, 0x72, 0x75, 0x73, 0x74, 0x2e, 0x6e, 0x65, 0x74, 0x2f, 0x63, 0x72, 0x6c, 0x2f, 0x64, 0x2d, 0x74, 0x72, 0x75, 0x73, 0x74, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x33, 0x5f, 0x63, 0x61, 0x5f, 0x32, 0x5f, 0x32, 0x30, 0x30, 0x39, 0x2e, 0x63, 0x72, 0x6c, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x7f, 0x97, 0xdb, 0x30, 0xc8, 0xdf, 0xa4, 0x9c, 0x7d, 0x21, 0x7a, 0x80, 0x70, 0xce, 0x14, 0x12, 0x69, 0x88, 0x14, 0x95, 0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0x8e, 0x66, 0x92, 0x09, 0x87, 0x36, 0xcd, 0x8b, 0x9b, 0x2d, 0x3e, 0xf6, 0x51, 0xd4, 0x50, 0xd4, 0x59, 0x28, 0xbd, 0x83, 0xf2, 0xcc, 0x28, 0x7b, 0x53, 0x86, 0x6d, 0xd8, 0x26, 0x88, 0x70, 0xd7, 0xea, 0x91, 0xcd, 0x3e, 0xb9, 0xca, 0xc0, 0x90, 0x6e, 0x5a, 0xc6, 0x5e, 0x74, 0x65, 0xd7, 0x5c, 0xfe, 0xa3, 0xe2 }; static const uint8_t g_certData04[] = { /* invalid data */ 0xa0, 0x41, 0xa0, 0x3f, 0x86, 0x3d, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x64, 0x2d, 0x74, 0x72, 0x75, 0x73, 0x74, 0x2e, 0x6e, 0x65, 0x74, 0x2f, 0x63, 0x72, 0x6c, 0x2f, 0x64, 0x2d, 0x74, 0x72, 0x75, 0x73, 0x74, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x33, 0x5f, 0x63, 0x61, 0x5f, 0x32, 0x5f, 0x32, 0x30, 0x30, 0x39, 0x2e, 0x63, 0x72, 0x6c, 0x30, 0x0d, 0x06, 0x09, 0x2a }; static const uint8_t g_certData05[] = { /* 2e0g9ue5 */ 0x30, 0x82, 0x02, 0xc1, 0x30, 0x82, 0x01, 0xa9, 0x02, 0x01, 0x01, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x30, 0x1a, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x0f, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x52, 0x6f, 0x6f, 0x74, 0x20, 0x43, 0x41, 0x30, 0x1e, 0x17, 0x0d, 0x32, 0x32, 0x31, 0x32, 0x31, 0x36, 0x31, 0x30, 0x33, 0x38, 0x31, 0x39, 0x5a, 0x17, 0x0d, 0x32, 0x35, 0x30, 0x39, 0x31, 0x30, 0x31, 0x30, 0x33, 0x38, 0x31, 0x39, 0x5a, 0x30, 0x33, 0x31, 0x0f, 0x30, 0x0d, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x06, 0x54, 0x45, 0x53, 0x54, 0x30, 0x31, 0x31, 0x0f, 0x30, 0x0d, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x0c, 0x06, 0x54, 0x45, 0x53, 0x54, 0x30, 0x32, 0x31, 0x0f, 0x30, 0x0d, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x06, 0x54, 0x45, 0x53, 0x54, 0x30, 0x33, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xa3, 0x21, 0x49, 0xd7, 0x60, 0xb9, 0x49, 0xe3, 0x40, 0x4e, 0x02, 0x92, 0x07, 0xa6, 0xfb, 0x4a, 0xef, 0x4d, 0xfa, 0x0b, 0xcc, 0xab, 0x5b, 0x7b, 0x1b, 0x86, 0x4f, 0x99, 0x77, 0xb3, 0x52, 0xd8, 0x79, 0x04, 0x1e, 0x80, 0xff, 0xed, 0xb8, 0xfd, 0x51, 0xfe, 0xdd, 0xed, 0xe3, 0xdd, 0x85, 0x76, 0xb0, 0xe4, 0x0a, 0xd7, 0xbf, 0x9a, 0x08, 0x33, 0xa5, 0x24, 0x37, 0xb1, 0xe6, 0x18, 0x9e, 0x32, 0xb6, 0x49, 0x4c, 0xcf, 0x8c, 0x94, 0x75, 0xd3, 0xf9, 0x44, 0xe2, 0xb5, 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35, 0x7b, 0xe4, 0x42, 0xb7, 0x62, 0x67, 0x2d, 0xcc, 0xcd, 0x8d, 0x52, 0x4d, 0xa3, 0xf3, 0x4f, 0x44, 0x47, 0xcf, 0xf3, 0x57, 0x96, 0xab, 0xef, 0xd5, 0xe8, 0x8c, 0xf6, 0xca, 0xed, 0x4b, 0x40, 0xae, 0xad, 0x6a, 0x03, 0xb5, 0x7a, 0xb6, 0xc8, 0x59, 0x7d, 0x32, 0x2f, 0x52, 0x6a, 0x29, 0x01, 0x51, 0xd1, 0x81, 0xe0, 0x8b, 0xb5, 0x1c, 0xaa, 0x09, 0xdb, 0x1c, 0x86, 0xbc, 0xd6, 0x95, 0x7c, 0x18, 0x1e, 0x53, 0x8d, 0x63, 0xf1, 0xc0, 0xae, 0x86, 0x91, 0x12, 0x67, 0xe0, 0x93, 0x78, 0xbf, 0x1a, 0x63, 0x27, 0x0a, 0x14, 0x29, 0x8d, 0x5f, 0x59, 0xae, 0x6b, 0x04, 0x1b }; struct UserCertListResult { struct CertAbstract certAbstract; bool bExpectResult; }; struct UserCertListResult g_certListExpectResult[] = { { { "oh:t=c;o=40dc992e;u=0;a=0", "40dc992e", true, "CN=Hellenic Academic and Research Institutions RootCA 2011,OU=," "O=Hellenic Academic and Research Institutions Cert. Authority" }, true }, { { "oh:t=c;o=985c1f52;u=0;a=0", "985c1f52", true, "CN=GlobalSign,OU=GlobalSign Root CA - R6,O=GlobalSign" }, true }, { { "oh:t=c;o=1df5a75f;u=0;a=0", "1df5a75f", true, "CN=D-TRUST Root Class 3 CA 2 2009,OU=,O=D-Trust GmbH" }, true }, { { "oh:t=c;o=2e0g9ue5;u=0;a=0", "2e0g9ue5", true, "CN=TEST01,OU=TEST02,O=TEST03" }, true } }; struct UserCertInfoResult { struct CertInfo certInfo; bool bExpectResult; }; struct UserCertInfoResult g_certInfoExpectResult[] = { { { "oh:t=c;o=40dc992e;u=0;a=0", "40dc992e", true, "CN=Hellenic Academic and Research Institutions RootCA 2011,OU=," "O=Hellenic Academic and Research Institutions Cert. Authority", "CN=Hellenic Academic and Research Institutions RootCA 2011,OU=," "O=Hellenic Academic and Research Institutions Cert. Authority", "0", "2011-12-6", "2031-12-1", "BC:10:4F:15:A4:8B:E7:09:DC:A5:42:A7:E1:D4:B9:DF:6F:05:45:27:E8:02:EA:A9:2D:59:54:44:25:8A:FE:71", { sizeof(g_certData01), const_cast(g_certData01) } }, true }, { { "oh:t=c;o=985c1f52;u=0;a=0", "985c1f52", true, "CN=GlobalSign,OU=GlobalSign Root CA - R6,O=GlobalSign", "CN=GlobalSign,OU=GlobalSign Root CA - R6,O=GlobalSign", "45E6BB038333C3856548E6FF4551", "2014-12-10", "2034-12-10", "2C:AB:EA:FE:37:D0:6C:A2:2A:BA:73:91:C0:03:3D:25:98:29:52:C4:53:64:73:49:76:3A:3A:B5:AD:6C:CF:69", { sizeof(g_certData02), const_cast(g_certData02) } }, true }, { { "oh:t=c;o=1df5a75f;u=0;a=0", "1df5a75f", true, "CN=D-TRUST Root Class 3 CA 2 2009,OU=,O=D-Trust GmbH", "CN=D-TRUST Root Class 3 CA 2 2009,OU=,O=D-Trust GmbH", "0983F3", "2009-11-5", "2029-11-5", "49:E7:A4:42:AC:F0:EA:62:87:05:00:54:B5:25:64:B6:50:E4:F4:9E:42:E3:48:D6:AA:38:E0:39:E9:57:B1:C1", { sizeof(g_certData03), const_cast(g_certData03) } }, true }, { { "oh:t=c;o=2e0g9ue5;u=0;a=0", "2e0g9ue5", true, "CN=Example Root CA,OU=,O=", "CN=TEST01,OU=TEST02,O=TEST03", "01", "2022-12-16", "2025-9-10", "60:57:A8:41:CD:4E:45:F6:7F:93:21:C4:E9:A0:F9:5F:45:CB:D5:39:02:43:A9:AF:4F:0A:04:D0:2C:41:99:68", { sizeof(g_certData05), const_cast(g_certData05) } }, true } }; struct UserCertStatusExpectResult { char uri[MAX_URI_LEN]; bool inparamStatus; bool expectStatus; }; struct UserCertStatusExpectResult g_certStatusExpectResult[] = { { {"oh:t=c;o=40dc992e;u=0;a=0"}, false, false }, { {"oh:t=c;o=985c1f52;u=0;a=0"}, false, false }, { {"oh:t=c;o=1df5a75f;u=0;a=0"}, true, true }, { {"oh:t=c;o=2e0g9ue5;u=0;a=0"}, true, true } }; struct CmBlob userCert[] = { { sizeof(g_certData01), const_cast(g_certData01) }, { sizeof(g_certData02), const_cast(g_certData02) }, { sizeof(g_certData03), const_cast(g_certData03) }, { sizeof(g_certData05), const_cast(g_certData05) } }; static uint8_t certAliasBuf01[] = "40dc992e"; static uint8_t certAliasBuf02[] = "985c1f52"; static uint8_t certAliasBuf03[] = "1df5a75f"; static uint8_t certAliasBuf05[] = "2e0g9ue5"; struct CmBlob certAlias[] = { { sizeof(certAliasBuf01), certAliasBuf01 }, { sizeof(certAliasBuf02), certAliasBuf02 }, { sizeof(certAliasBuf03), certAliasBuf03 }, { sizeof(certAliasBuf05), certAliasBuf05 } }; class CmUserCertTest : public testing::Test { public: static void SetUpTestCase(void); static void TearDownTestCase(void); void SetUp(); void TearDown(); }; void CmUserCertTest::SetUpTestCase(void) { SetATPermission(); } void CmUserCertTest::TearDownTestCase(void) { } void CmUserCertTest::SetUp() { } void CmUserCertTest::TearDown() { } /** * @tc.name: InstallUserCertTest001 * @tc.desc: Test CertManager Install user cert interface base function * @tc.type: FUNC * @tc.require: AR000H0MJ8 /SR000H09N7 */ HWTEST_F(CmUserCertTest, InstallUserCertTest001, TestSize.Level0) { int32_t ret; uint8_t uriBuf001[MAX_URI_LEN] = {0}; struct CmBlob certUri = { sizeof(uriBuf001), uriBuf001 }; ret = CmInstallUserTrustedCert(&userCert[0], &certAlias[0], &certUri); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Install test failed, recode:" << ret; ret = CmUninstallUserTrustedCert(&certUri); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Uninstall test failed, recode:" << ret; } /** * @tc.name: InstallUserCertTest002 * @tc.desc: Test CertManager Install cert interface base function * @tc.type: FUNC * @tc.require: AR000H0MJ8 /SR000H09N7 */ HWTEST_F(CmUserCertTest, InstallUserCertTest002, TestSize.Level0) { int32_t ret; uint8_t uriBuf002[MAX_URI_LEN] = {0}; struct CmBlob certUri = { sizeof(uriBuf002), uriBuf002 }; ret = CmInstallUserTrustedCert(&userCert[1], &certAlias[1], &certUri); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Install test failed, recode:" << ret; ret = CmUninstallUserTrustedCert(&certUri); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Uninstall test failed, recode:" << ret; } /** * @tc.name: InstallUserCertTest003 * @tc.desc: Test CertManager Install user cert interface base function * @tc.type: FUNC * @tc.require: AR000H0MJ8 /SR000H09N7 */ HWTEST_F(CmUserCertTest, InstallUserCertTest003, TestSize.Level0) { int32_t ret; uint8_t uriBuf003[MAX_URI_LEN] = {0}; struct CmBlob certUri = { sizeof(uriBuf003), uriBuf003 }; ret = CmInstallUserTrustedCert(&userCert[2], &certAlias[2], &certUri); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Install test failed, recode:" << ret; ret = CmUninstallUserTrustedCert(&certUri); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Uninstall test failed, recode:" << ret; } /** * @tc.name: InstallUserCertTest004 * @tc.desc: Test CertManager Update user cert interface base function * @tc.type: FUNC * @tc.require: AR000H0MJ8 /SR000H09N7 */ HWTEST_F(CmUserCertTest, InstallUserCertTest004, TestSize.Level0) { int32_t ret; uint8_t aliasBuf001[] = "40dc992e"; uint8_t uriBuf004[MAX_URI_LEN] = {0}; struct CmBlob userCertUpdate = { sizeof(g_certData01), const_cast(g_certData01) }; struct CmBlob certAliasUpdate = { sizeof(aliasBuf001), aliasBuf001 }; struct CmBlob certUriUpdate = { sizeof(uriBuf004), uriBuf004 }; ret = CmInstallUserTrustedCert(&userCertUpdate, &certAliasUpdate, &certUriUpdate); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Install test failed, recode:" << ret; ret = CmInstallUserTrustedCert(&userCertUpdate, &certAliasUpdate, &certUriUpdate); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Install test failed, recode:" << ret; ret = CmUninstallUserTrustedCert(&certUriUpdate); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Uninstall test failed, recode:" << ret; } /** * @tc.name: InstallUserCertTest005 * @tc.desc: Test CertManager Install user cert interface Abnormal function * @tc.type: FUNC * @tc.require: AR000H0MJ8 /SR000H09N7 */ HWTEST_F(CmUserCertTest, InstallUserCertTest005, TestSize.Level0) { int32_t ret; uint8_t aliasBuf002[] = "abnormal-invalid-certdata"; uint8_t uriBuf005[MAX_URI_LEN] = {0}; struct CmBlob userCertTemp = { sizeof(g_certData04), const_cast(g_certData04) }; /* invalid certData */ struct CmBlob certAliasTemp = { sizeof(aliasBuf002), aliasBuf002 }; struct CmBlob certUriTemp = { sizeof(uriBuf005), uriBuf005 }; ret = CmInstallUserTrustedCert(&userCertTemp, &certAliasTemp, &certUriTemp); EXPECT_EQ(ret, CMR_ERROR_INVALID_CERT_FORMAT) << "Normal user cert Install test failed, recode:" << ret; } /** * @tc.name: InstallUserCertTest006 * @tc.desc: Test CertManager Install user cert interface Abnormal function * @tc.type: FUNC * @tc.require: AR000H0MJ8 /SR000H09N7 */ HWTEST_F(CmUserCertTest, InstallUserCertTest006, TestSize.Level0) { int32_t ret; uint8_t aliasBuf003[] = "abnormal-inputparam-null"; uint8_t uriBuf006[MAX_URI_LEN] = {0}; struct CmBlob userCertTemp = { sizeof(g_certData03), const_cast(g_certData03) }; struct CmBlob certAliasTemp = { sizeof(aliasBuf003), aliasBuf003 }; struct CmBlob certUriTemp = { sizeof(uriBuf006), uriBuf006 }; ret = CmInstallUserTrustedCert(nullptr, &certAliasTemp, &certUriTemp); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT) << "Normal user cert Install test failed, recode:" << ret; ret = CmInstallUserTrustedCert(&userCertTemp, nullptr, &certUriTemp); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT) << "Normal user cert Install test failed, recode:" << ret; ret = CmInstallUserTrustedCert(&userCertTemp, &certAliasTemp, nullptr); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT) << "Normal user cert Install test failed, recode:" << ret; } /** * @tc.name: InstallUserCertTest007 * @tc.desc: Test CertManager install max count user cert interface base function * @tc.type: FUNC * @tc.require: AR000H0MJ8 /SR000H09N7 */ HWTEST_F(CmUserCertTest, InstallUserCertTest007, TestSize.Level0) { int32_t ret; struct CmBlob userCertTest = { sizeof(g_certData01), const_cast(g_certData01) }; for (uint32_t i = 0; i < MAX_COUNT_CERTIFICATE; i++) { /* install 256 times user cert */ char alias[] = "alias"; char aliasBuf004[MAX_LEN_CERT_ALIAS]; (void)snprintf_s(aliasBuf004, MAX_LEN_CERT_ALIAS, MAX_LEN_CERT_ALIAS - 1, "%s%u", alias, i); struct CmBlob certAliasTest = { strlen(aliasBuf004) + 1, reinterpret_cast(aliasBuf004) }; uint8_t uriBuf007[MAX_URI_LEN] = {0}; struct CmBlob certUriTest = { sizeof(uriBuf007), uriBuf007 }; ret = CmInstallUserTrustedCert(&userCertTest, &certAliasTest, &certUriTest); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Install test failed, recode:" << ret; } uint8_t certAliasBuf257[] = "40dc992e"; /* install 257th user cert */ uint8_t certUriBuf257[MAX_URI_LEN] = {0}; struct CmBlob certAlias257 = { sizeof(certAliasBuf257), certAliasBuf257 }; struct CmBlob certUri257 = { sizeof(certUriBuf257), certUriBuf257 }; ret = CmInstallUserTrustedCert(&userCertTest, &certAlias257, &certUri257); EXPECT_EQ(ret, CM_FAILURE) << "Normal user cert Install test failed, recode:" << ret; uint8_t certAliasBuf000[] = "alias0"; /* update 001th user cert */ uint8_t certUriBuf000[MAX_URI_LEN] = {0}; struct CmBlob certAlias000 = { sizeof(certAliasBuf000), certAliasBuf000 }; struct CmBlob certUri000 = { sizeof(certUriBuf000), certUriBuf000 }; ret = CmInstallUserTrustedCert(&userCertTest, &certAlias000, &certUri000); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Install test failed, recode:" << ret; ret = CmUninstallAllUserTrustedCert(); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Uninstall All test failed, recode:" << ret; } /** * @tc.name: InstallUserCertTest008 * @tc.desc: Test CertManager Install user cert interface performance * @tc.type: FUNC * @tc.require: AR000H0MJ8 /SR000H09N7 */ HWTEST_F(CmUserCertTest, InstallUserCertTest008, TestSize.Level0) { int32_t ret; for (uint32_t times = 0; times < PERFORMACE_COUNT; ++times) { uint8_t uriBuf008[MAX_URI_LEN] = {0}; struct CmBlob certUri = { sizeof(uriBuf008), uriBuf008 }; ret = CmInstallUserTrustedCert(&userCert[2], &certAlias[2], &certUri); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Install test failed, recode:" << ret; ret = CmUninstallUserTrustedCert(&certUri); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Uninstall test failed, recode:" << ret; } } /** * @tc.name: InstallUserCertTest009 * @tc.desc: Test CertManager Install user cert interface Abnormal function * @tc.type: FUNC * @tc.require: AR000H0MJ8 /SR000H09N7 */ HWTEST_F(CmUserCertTest, InstallUserCertTest009, TestSize.Level0) { int32_t ret; uint8_t largeAliasBuf[] = "large-size-input-cert-alias-000000000000000000000000000000000000"; uint8_t certUriBuf[MAX_URI_LEN] = {0}; struct CmBlob userCertTemp = { sizeof(g_certData02), const_cast(g_certData02) }; struct CmBlob largeAlias = { sizeof(largeAliasBuf), largeAliasBuf }; struct CmBlob certUriTemp = { sizeof(certUriBuf), certUriBuf }; ret = CmInstallUserTrustedCert(&userCertTemp, &largeAlias, &certUriTemp); EXPECT_EQ(ret, CM_FAILURE) << "Normal user cert Install test failed, recode:" << ret; } /** * @tc.name: InstallUserCertTest010 * @tc.desc: Test CertManager Install user cert interface Abnormal function * @tc.type: FUNC * @tc.require: AR000H0MJ8 /SR000H09N7 */ HWTEST_F(CmUserCertTest, InstallUserCertTest010, TestSize.Level0) { int32_t ret; char errAliasBuf[] = "AliasNoEnd"; uint8_t certUriBuf[MAX_URI_LEN] = {0}; struct CmBlob userCertTemp = { sizeof(g_certData01), const_cast(g_certData01) }; struct CmBlob noEndAlias = { strlen(errAliasBuf), reinterpret_cast(errAliasBuf) }; struct CmBlob certUriTemp = { sizeof(certUriBuf), certUriBuf }; ret = CmInstallUserTrustedCert(&userCertTemp, &noEndAlias, &certUriTemp); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT) << "Normal user cert Install test failed, recode:" << ret; } /** * @tc.name: InstallUserCertTest011 * @tc.desc: Test CertManager Install user cert interface Abnormal function * @tc.type: FUNC * @tc.require: AR000H0MJ8 /SR000H09N7 */ HWTEST_F(CmUserCertTest, InstallUserCertTest011, TestSize.Level0) { int32_t ret; char edgeAliasBuf[] = "aliaslengthis4800000000000000000000000000000000"; /* size is 48 */ uint8_t largeUriBuf[MAX_URI_LEN] = {0}; /* oh:t=c;o=;u=0;a=0 + alias size is 65 */ struct CmBlob userCertTemp = { sizeof(g_certData01), const_cast(g_certData01) }; struct CmBlob edgeAlias = { strlen(edgeAliasBuf) + 1, reinterpret_cast(edgeAliasBuf) }; struct CmBlob largeUri = { sizeof(largeUriBuf), largeUriBuf }; ret = CmInstallUserTrustedCert(&userCertTemp, &edgeAlias, &largeUri); EXPECT_EQ(ret, CM_FAILURE) << "Normal user cert Install test failed, recode:" << ret; } /** * @tc.name: UninstallUserCertTest001 * @tc.desc: Test CertManager Uninstall user cert interface base function * @tc.type: FUNC * @tc.require: AR000H0MJ8 /SR000H09N7 */ HWTEST_F(CmUserCertTest, UninstallUserCertTest001, TestSize.Level0) { int32_t ret; uint8_t aliasBuf005[] = "985c1f52"; uint8_t uriBuf009[MAX_URI_LEN] = {0}; struct CmBlob userCertTemp = { sizeof(g_certData02), const_cast(g_certData02) }; struct CmBlob certAliasTemp = { sizeof(aliasBuf005), aliasBuf005 }; struct CmBlob certUriTemp = { sizeof(uriBuf009), uriBuf009 }; ret = CmInstallUserTrustedCert(&userCertTemp, &certAliasTemp, &certUriTemp); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Install test failed, recode:" << ret; ret = CmUninstallUserTrustedCert(&certUriTemp); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Uninstall test failed, recode:" << ret; } /** * @tc.name: UninstallUserCertTest002 * @tc.desc: Test CertManager Uninstall user cert interface Abnormal function * @tc.type: FUNC * @tc.require: AR000H0MJ8 /SR000H09N7 */ HWTEST_F(CmUserCertTest, UninstallUserCertTest002, TestSize.Level0) { int32_t ret; uint8_t aliasBuf006[] = "40dc992e"; uint8_t uriBuf010[MAX_URI_LEN] = {0}; struct CmBlob userCertTemp = { sizeof(g_certData01), const_cast(g_certData01) }; struct CmBlob certAliasTemp = { sizeof(aliasBuf006), aliasBuf006 }; struct CmBlob certUriTemp = { sizeof(uriBuf010), uriBuf010 }; ret = CmInstallUserTrustedCert(&userCertTemp, &certAliasTemp, &certUriTemp); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Install test failed, recode:" << ret; ret = CmUninstallUserTrustedCert(nullptr); /* uri is nullptr */ EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT) << "Normal user cert Uninstall test failed, recode:" << ret; ret = CmUninstallUserTrustedCert(&certUriTemp); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Uninstall test failed, recode:" << ret; } /** * @tc.name: UninstallUserCertTest003 * @tc.desc: Test CertManager Uninstall user cert interface Abnormal function * @tc.type: FUNC * @tc.require: AR000H0MJ8 /SR000H09N7 */ HWTEST_F(CmUserCertTest, UninstallUserCertTest003, TestSize.Level0) { int32_t ret; uint8_t aliasBuf007[] = "985c1f52"; uint8_t uriBuf011[MAX_URI_LEN] = {0}; struct CmBlob userCertTemp = { sizeof(g_certData02), const_cast(g_certData02) }; struct CmBlob certAliasTemp = { sizeof(aliasBuf007), aliasBuf007 }; struct CmBlob certUriTemp = { sizeof(uriBuf011), uriBuf011 }; ret = CmInstallUserTrustedCert(&userCertTemp, &certAliasTemp, &certUriTemp); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Install test failed, recode:" << ret; uint8_t errUriBuf[MAX_URI_LEN] = "*****"; /* error uri */ struct CmBlob errUri = { sizeof(errUriBuf), errUriBuf }; ret = CmUninstallUserTrustedCert(&errUri); EXPECT_EQ(ret, CMR_ERROR_INVALID_ARGUMENT) << "Normal user cert Uninstall test failed, recode:" << ret; ret = CmUninstallUserTrustedCert(&certUriTemp); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Uninstall test failed, recode:" << ret; } /** * @tc.name: UninstallUserCertTest004 * @tc.desc: Test CertManager Uninstall user cert interface Abnormal function * @tc.type: FUNC * @tc.require: AR000H0MJ8 /SR000H09N7 */ HWTEST_F(CmUserCertTest, UninstallUserCertTest004, TestSize.Level0) { int32_t ret; char invalidUriBuf[] = "oh:t=c;o=NOEXIST;u=0;a=0"; /* cert of uri is not exist */ struct CmBlob invalidUri = { strlen(invalidUriBuf) + 1, reinterpret_cast(invalidUriBuf) }; ret = CmUninstallUserTrustedCert(&invalidUri); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Uninstall test failed, recode:" << ret; } /** * @tc.name: UninstallALLUserCertTest001 * @tc.desc: Test CertManager uninstall all user cert interface base function * @tc.type: FUNC * @tc.require: AR000H0MJ8 /SR000H09N7 */ HWTEST_F(CmUserCertTest, UninstallALLUserCertTest001, TestSize.Level0) { int32_t ret; uint32_t size = sizeof(certAlias) / sizeof(certAlias[0]); for (uint32_t i = 0; i < size; i++) { uint8_t uriBuf012[MAX_URI_LEN] = {0}; struct CmBlob certUri = { sizeof(uriBuf012), uriBuf012 }; ret = CmInstallUserTrustedCert(&userCert[i], &certAlias[i], &certUri); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Install test failed, recode:" << ret; } ret = CmUninstallAllUserTrustedCert(); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Uninstall All test failed, recode:" << ret; } /** * @tc.name: UninstallALLUserCertTest002 * @tc.desc: Test CertManager uninstall all user cert interface performance * @tc.type: FUNC * @tc.require: AR000H0MJ8 /SR000H09N7 */ HWTEST_F(CmUserCertTest, UninstallALLUserCertTest002, TestSize.Level0) { int32_t ret; for (uint32_t time = 0; time < PERFORMACE_COUNT; time++) { uint32_t size = sizeof(certAlias) / sizeof(certAlias[0]); for (uint32_t i = 0; i < size; i++) { uint8_t uriBuf013[MAX_URI_LEN] = {0}; struct CmBlob certUriTemp = { sizeof(uriBuf013), uriBuf013 }; ret = CmInstallUserTrustedCert(&userCert[i], &certAlias[i], &certUriTemp); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Install test failed, recode:" << ret; } ret = CmUninstallAllUserTrustedCert(); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Uninstall All test failed, recode:" << ret; } } /** * @tc.name: GetUserCertListTest001 * @tc.desc: Test CertManager Get user cert list interface base function * @tc.type: FUNC * @tc.require: AR000H0MJ8 /SR000H09N7 */ HWTEST_F(CmUserCertTest, GetUserCertListTest001, TestSize.Level0) { int32_t ret; uint32_t size = sizeof(certAlias) / sizeof(certAlias[0]); for (uint32_t i = 0; i < size; i++) { uint8_t uriBuf014[MAX_URI_LEN] = {0}; struct CmBlob certUri = { sizeof(uriBuf014), uriBuf014 }; ret = CmInstallUserTrustedCert(&userCert[i], &certAlias[i], &certUri); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Install test failed, recode:" << ret; } struct CertList *certList001 = nullptr; InitCertList(&certList001); ret = CmGetUserCertList(CM_USER_TRUSTED_STORE, certList001); EXPECT_EQ(ret, CM_SUCCESS) << "Normal get user cert list test failed, recode:" << ret; FreeCertList(certList001); ret = CmUninstallAllUserTrustedCert(); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Uninstall All test failed, recode:" << ret; } /** * @tc.name: GetUserCertListTest002 * @tc.desc: Test CertManager Get user cert list And check content interface function * @tc.type: FUNC * @tc.require: AR000H0MJ8 /SR000H09N7 */ HWTEST_F(CmUserCertTest, GetUserCertListTest002, TestSize.Level0) { int32_t ret; uint32_t size = sizeof(certAlias) / sizeof(certAlias[0]); for (uint32_t i = 0; i < size; i++) { uint8_t uriBuf015[MAX_URI_LEN] = {0}; struct CmBlob certUri = { sizeof(uriBuf015), uriBuf015 }; ret = CmInstallUserTrustedCert(&userCert[i], &certAlias[i], &certUri); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Install test failed, recode:" << ret; } struct CertList *certList002 = nullptr; InitCertList(&certList002); ret = CmGetUserCertList(CM_USER_TRUSTED_STORE, certList002); EXPECT_EQ(ret, CM_SUCCESS) << "Normal get user cert list test failed, recode:" << ret; uint32_t len = sizeof(g_certListExpectResult) / sizeof(g_certListExpectResult[0]); bool found = false; for (uint32_t i = 0; i < len; i++) { found = FindCertAbstract(&(g_certListExpectResult[i].certAbstract), certList002); EXPECT_EQ(found, g_certListExpectResult[i].bExpectResult) << DumpCertList(certList002); } FreeCertList(certList002); ret = CmUninstallAllUserTrustedCert(); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Uninstall All test failed, recode:" << ret; } /** * @tc.name: GetUserCertListTest003 * @tc.desc: Test CertManager Get user cert list interface Abnormal function * @tc.type: FUNC * @tc.require: AR000H0MJ8 /SR000H09N7 */ HWTEST_F(CmUserCertTest, GetUserCertListTest003, TestSize.Level0) { int32_t ret; uint32_t size = sizeof(certAlias) / sizeof(certAlias[0]); for (uint32_t i = 0; i < size; i++) { uint8_t uriBuf016[MAX_URI_LEN] = {0}; struct CmBlob certUri = { sizeof(uriBuf016), uriBuf016 }; ret = CmInstallUserTrustedCert(&userCert[i], &certAlias[i], &certUri); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Install test failed, recode:" << ret; } ret = CmGetUserCertList(CM_USER_TRUSTED_STORE, nullptr); /* cList is nullptr */ EXPECT_EQ(ret, CMR_ERROR_NULL_POINTER); struct CertList *certList003 = nullptr; InitCertList(&certList003); ret = CmGetUserCertList(100, certList003); /* invalid store 100 */ EXPECT_EQ(ret, CM_FAILURE); FreeCertList(certList003); ret = CmUninstallAllUserTrustedCert(); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Uninstall All test failed, recode:" << ret; } /** * @tc.name: GetUserCertListTest004 * @tc.desc: Test CertManager Get user cert list interface performance * @tc.type: FUNC * @tc.require: AR000H0MJ8 /SR000H09N7 */ HWTEST_F(CmUserCertTest, GetUserCertListTest004, TestSize.Level0) { int32_t ret; uint32_t size = sizeof(certAlias) / sizeof(certAlias[0]); for (uint32_t i = 0; i < size; i++) { uint8_t uriBuf017[MAX_URI_LEN] = {0}; struct CmBlob certUri = { sizeof(uriBuf017), uriBuf017 }; ret = CmInstallUserTrustedCert(&userCert[i], &certAlias[i], &certUri); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Install test failed, recode:" << ret; } for (uint32_t times = 0; times < PERFORMACE_COUNT; ++times) { struct CertList *certList004 = nullptr; InitCertList(&certList004); ret = CmGetUserCertList(CM_USER_TRUSTED_STORE, certList004); EXPECT_EQ(ret, CM_SUCCESS) << "Normal get user cert list test failed, recode:" << ret; FreeCertList(certList004); } ret = CmUninstallAllUserTrustedCert(); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Uninstall All test failed, recode:" << ret; } /** * @tc.name: GetUserCertListTest005 * @tc.desc: Test CertManager Get user cert list interface Abnormal function * @tc.type: FUNC * @tc.require: AR000H0MJ8 /SR000H09N7 */ HWTEST_F(CmUserCertTest, GetUserCertListTest005, TestSize.Level0) { struct CertList *certList005 = nullptr; InitCertList(&certList005); int32_t ret = CmGetUserCertList(CM_USER_TRUSTED_STORE, certList005); /* empty dir */ EXPECT_EQ(ret, CM_SUCCESS) << "Normal get user cert list test failed, recode:" << ret; FreeCertList(certList005); } /** * @tc.name: GetUserCertInfoTest001 * @tc.desc: Test CertManager Get user cert info interface base function * @tc.type: FUNC * @tc.require: AR000H0MJ8 /SR000H09N7 */ HWTEST_F(CmUserCertTest, GetUserCertInfoTest001, TestSize.Level0) { int32_t ret; uint8_t aliasBuf008[] = "40dc992e"; uint8_t uriBuf018[MAX_URI_LEN] = {0}; struct CmBlob testUserCert = { sizeof(g_certData01), const_cast(g_certData01) }; struct CmBlob testCertAlias = { sizeof(aliasBuf008), aliasBuf008 }; struct CmBlob testCertUri = { sizeof(uriBuf018), uriBuf018 }; ret = CmInstallUserTrustedCert(&testUserCert, &testCertAlias, &testCertUri); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Install test failed, recode:" << ret; struct CertInfo *certInfo001 = nullptr; InitUserCertInfo(&certInfo001); ret = CmGetUserCertInfo(&testCertUri, CM_USER_TRUSTED_STORE, certInfo001); EXPECT_EQ(ret, CM_SUCCESS) << "Normal get user cert info test failed, recode:" << ret; EXPECT_EQ(CompareCertInfo(certInfo001, &(g_certInfoExpectResult[0].certInfo)), true) << DumpCertInfo(certInfo001); EXPECT_EQ(CompareCertData(&(certInfo001->certInfo), &(g_certInfoExpectResult[0].certInfo.certInfo)), true); FreeCertInfo(certInfo001); ret = CmUninstallUserTrustedCert(&testCertUri); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Uninstall test failed, recode:" << ret; } /** * @tc.name: GetUserCertInfoTest002 * @tc.desc: Test CertManager Get user cert info interface base function * @tc.type: FUNC * @tc.require: AR000H0MJ8 /SR000H09N7 */ HWTEST_F(CmUserCertTest, GetUserCertInfoTest002, TestSize.Level0) { int32_t ret; uint32_t size = sizeof(certAlias) / sizeof(certAlias[0]); for (uint32_t i = 0; i < size; i++) { uint8_t uriBuf019[MAX_URI_LEN] = {0}; struct CmBlob certUri = { sizeof(uriBuf019), uriBuf019 }; ret = CmInstallUserTrustedCert(&userCert[i], &certAlias[i], &certUri); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Install test failed, recode:" << ret; } struct CertList *certList006 = nullptr; InitCertList(&certList006); ret = CmGetUserCertList(CM_USER_TRUSTED_STORE, certList006); EXPECT_EQ(ret, CM_SUCCESS) << "Normal get user cert list test failed, recode:" << ret; uint32_t certCnt = sizeof(g_certInfoExpectResult) / sizeof(g_certInfoExpectResult[0]); bool found = false; for (uint32_t i = 0; i < certCnt; i++) { struct CertAbstract *ptr = &(g_certListExpectResult[i].certAbstract); ASSERT_TRUE(ptr != nullptr); found = FindCertAbstract(ptr, certList006); EXPECT_EQ(found, g_certListExpectResult[i].bExpectResult); struct CmBlob uriBlob = { strlen(ptr->uri) + 1, reinterpret_cast(ptr->uri) }; struct CertInfo *certInfo002 = nullptr; InitUserCertInfo(&certInfo002); ret = CmGetUserCertInfo(&uriBlob, CM_USER_TRUSTED_STORE, certInfo002); EXPECT_EQ(ret, CM_SUCCESS) << "Normal get user cert info test failed, recode:" << ret; EXPECT_EQ(CompareCertInfo(certInfo002, &(g_certInfoExpectResult[i].certInfo)), true) << DumpCertInfo(certInfo002); EXPECT_EQ(CompareCertData(&(certInfo002->certInfo), &(g_certInfoExpectResult[i].certInfo.certInfo)), true); FreeCertInfo(certInfo002); } FreeCertList(certList006); ret = CmUninstallAllUserTrustedCert(); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Uninstall All test failed, recode:" << ret; } /** * @tc.name: GetUserCertInfoTest003 * @tc.desc: Test CertManager Get user cert info interface Abnormal function * @tc.type: FUNC * @tc.require: AR000H0MJ8 /SR000H09N7 */ HWTEST_F(CmUserCertTest, GetUserCertInfoTest003, TestSize.Level0) { int32_t ret; struct CertInfo *certInfo003 = nullptr; InitUserCertInfo(&certInfo003); ret = CmGetUserCertInfo(nullptr, CM_USER_TRUSTED_STORE, certInfo003); /* uri is nullptr */ EXPECT_EQ(ret, CMR_ERROR_NULL_POINTER); FreeCertInfo(certInfo003); } /** * @tc.name: GetUserCertInfoTest004 * @tc.desc: Test CertManager Get user cert info interface Abnormal function * @tc.type: FUNC * @tc.require: AR000H0MJ8 /SR000H09N7 */ HWTEST_F(CmUserCertTest, GetUserCertInfoTest004, TestSize.Level0) { int32_t ret; char *uri = g_certInfoExpectResult[0].certInfo.uri; struct CmBlob certUri = { strlen(uri) + 1, reinterpret_cast(uri) }; struct CertInfo *certInfo004 = nullptr; InitUserCertInfo(&certInfo004); ret = CmGetUserCertInfo(&certUri, 100, certInfo004); /* invalid store 100 */ EXPECT_EQ(ret, CM_FAILURE); FreeCertInfo(certInfo004); } /** * @tc.name: GetUserCertInfoTest005 * @tc.desc: Test CertManager Get user cert info interface Abnormal function * @tc.type: FUNC * @tc.require: AR000H0MJ8 /SR000H09N7 */ HWTEST_F(CmUserCertTest, GetUserCertInfoTest005, TestSize.Level0) { int32_t ret; char *uri = g_certInfoExpectResult[1].certInfo.uri; struct CmBlob certUri = { strlen(uri) + 1, reinterpret_cast(uri) }; ret = CmGetUserCertInfo(&certUri, CM_USER_TRUSTED_STORE, nullptr); /* cInfo not malloc */ EXPECT_EQ(ret, CMR_ERROR_NULL_POINTER); } /** * @tc.name: GetUserCertInfoTest006 * @tc.desc: Test CertManager Get user cert info interface performance * @tc.type: FUNC * @tc.require: AR000H0MJ8 /SR000H09N7 */ HWTEST_F(CmUserCertTest, GetUserCertInfoTest006, TestSize.Level0) { int32_t ret; uint8_t aliasBuf009[] = "40dc992e"; uint8_t uriBuf020[MAX_URI_LEN] = {0}; struct CmBlob userCertTemp = { sizeof(g_certData01), const_cast(g_certData01) }; struct CmBlob certAliasTemp = { sizeof(aliasBuf009), aliasBuf009 }; struct CmBlob certUri = { sizeof(uriBuf020), uriBuf020 }; for (uint32_t time = 0; time < PERFORMACE_COUNT; time++) { ret = CmInstallUserTrustedCert(&userCertTemp, &certAliasTemp, &certUri); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Install test failed, recode:" << ret; struct CertInfo *certInfo005 = nullptr; InitUserCertInfo(&certInfo005); ret = CmGetUserCertInfo(&certUri, CM_USER_TRUSTED_STORE, certInfo005); EXPECT_EQ(ret, CM_SUCCESS) << "Normal get user cert info test failed, recode:" << ret; EXPECT_EQ(CompareCertInfo(certInfo005, &(g_certInfoExpectResult[0].certInfo)), true) << DumpCertInfo(certInfo005); EXPECT_EQ(CompareCertData(&(certInfo005->certInfo), &(g_certInfoExpectResult[0].certInfo.certInfo)), true); FreeCertInfo(certInfo005); ret = CmUninstallUserTrustedCert(&certUri); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Uninstall test failed, recode:" << ret; } } /** * @tc.name: SetUserCertStatusTest001 * @tc.desc: Test CertManager Set user cert status interface base function * @tc.type: FUNC * @tc.require: AR000H0MJ8 /SR000H09N7 */ HWTEST_F(CmUserCertTest, SetUserCertStatusTest001, TestSize.Level0) { int32_t ret; uint8_t aliasBuf010[] = "1df5a75f"; uint8_t uriBuf021[MAX_URI_LEN] = {0}; struct CmBlob userCertTemp = { sizeof(g_certData03), const_cast(g_certData03) }; struct CmBlob certAliasTemp = { sizeof(aliasBuf010), aliasBuf010 }; struct CmBlob certUri = { sizeof(uriBuf021), uriBuf021 }; ret = CmInstallUserTrustedCert(&userCertTemp, &certAliasTemp, &certUri); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Install test failed, recode:" << ret; char *uri = g_certStatusExpectResult[2].uri; struct CmBlob uriTemp = { strlen(uri) + 1, reinterpret_cast(uri) }; ret = CmSetUserCertStatus(&uriTemp, CM_USER_TRUSTED_STORE, g_certStatusExpectResult[2].inparamStatus); EXPECT_EQ(ret, CM_SUCCESS) << "Normal set user cert status test failed, recode:" << ret; ret = CmSetUserCertStatus(&uriTemp, CM_USER_TRUSTED_STORE, true); EXPECT_EQ(ret, CM_SUCCESS) << "Normal set user cert status test failed, recode:" << ret; ret = CmUninstallUserTrustedCert(&certUri); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Uninstall test failed, recode:" << ret; } /** * @tc.name: SetUserCertStatusTest002 * @tc.desc: Test CertManager set user cert status interface base function * @tc.type: FUNC * @tc.require: AR000H0MJ8 /SR000H09N7 */ HWTEST_F(CmUserCertTest, SetUserCertStatusTest002, TestSize.Level0) { int32_t ret; uint32_t size = sizeof(certAlias) / sizeof(certAlias[0]); for (uint32_t i = 0; i < size; i++) { uint8_t uriBuf022[MAX_URI_LEN] = {0}; struct CmBlob certUriTemp = { sizeof(uriBuf022), uriBuf022 }; ret = CmInstallUserTrustedCert(&userCert[i], &certAlias[i], &certUriTemp); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Install test failed, recode:" << ret; } uint32_t len = sizeof(g_certStatusExpectResult) / sizeof(g_certStatusExpectResult[0]); for (uint32_t i = 0; i < len; i++) { struct CmBlob certUri = { strlen(g_certStatusExpectResult[i].uri) + 1, reinterpret_cast(g_certStatusExpectResult[i].uri) }; ret = CmSetUserCertStatus(&certUri, CM_USER_TRUSTED_STORE, g_certStatusExpectResult[i].inparamStatus); EXPECT_EQ(ret, CM_SUCCESS) << "Normal set user cert status test failed, recode:" << ret; struct CertInfo *certInfo006 = nullptr; InitUserCertInfo(&certInfo006); ret = CmGetUserCertInfo(&certUri, CM_USER_TRUSTED_STORE, certInfo006); EXPECT_EQ(ret, CM_SUCCESS) << "Normal get user cert info test failed, recode:" << ret; int32_t status = (g_certStatusExpectResult[i].expectStatus == certInfo006->status) ? 1 : 0; EXPECT_EQ(status, 1) << "set user cert status test failed, cert info: " << DumpCertInfo(certInfo006); FreeCertInfo(certInfo006); ret = CmSetUserCertStatus(&certUri, CM_USER_TRUSTED_STORE, true); EXPECT_EQ(ret, CM_SUCCESS) << "Normal set user cert status test failed, recode:" << ret; } ret = CmUninstallAllUserTrustedCert(); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Uninstall All test failed, recode:" << ret; } /** * @tc.name: SetUserCertStatusTest003 * @tc.desc: Test CertManager Set user cert status interface base function * @tc.type: FUNC * @tc.require: AR000H0MJ8 /SR000H09N7 */ HWTEST_F(CmUserCertTest, SetUserCertStatusTest003, TestSize.Level0) { int32_t ret; uint32_t size = sizeof(certAlias) / sizeof(certAlias[0]); for (uint32_t i = 0; i < size; i++) { uint8_t uriBuf023[MAX_URI_LEN] = {0}; struct CmBlob certUriTemp = { sizeof(uriBuf023), uriBuf023 }; ret = CmInstallUserTrustedCert(&userCert[i], &certAlias[i], &certUriTemp); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Install test failed, recode:" << ret; } struct CertList *certList007 = nullptr; InitCertList(&certList007); ret = CmGetUserCertList(CM_USER_TRUSTED_STORE, certList007); EXPECT_EQ(ret, CM_SUCCESS) << "Normal get user cert list test failed, recode:" << ret; for (uint32_t i = 0; i < certList007->certsCount; ++i) { struct CertAbstract *ptr = &(certList007->certAbstract[i]); struct CmBlob uri01 = { strlen(ptr->uri) + 1, reinterpret_cast(ptr->uri) }; ret = CmSetUserCertStatus(&uri01, CM_USER_TRUSTED_STORE, false); EXPECT_EQ(ret, CM_SUCCESS) << "Normal set user cert status test failed, recode:" << ret; } for (uint32_t i = 0; i < certList007->certsCount; ++i) { struct CertAbstract *ptr = &(certList007->certAbstract[i]); struct CmBlob uri02 = { strlen(ptr->uri) + 1, reinterpret_cast(ptr->uri) }; ret = CmSetUserCertStatus(&uri02, CM_USER_TRUSTED_STORE, true); EXPECT_EQ(ret, CM_SUCCESS) << "Normal set user cert status test failed, recode:" << ret; } FreeCertList(certList007); ret = CmUninstallAllUserTrustedCert(); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Uninstall All test failed, recode:" << ret; } /** * @tc.name: SetUserCertStatusTest004 * @tc.desc: Test CertManager set user cert status interface Abnormal function * @tc.type: FUNC * @tc.require: AR000H0MJ8 /SR000H09N7 */ HWTEST_F(CmUserCertTest, SetUserCertStatusTest004, TestSize.Level0) { int32_t ret; ret = CmSetUserCertStatus(nullptr, CM_USER_TRUSTED_STORE, true); /* uri is nullptr */ EXPECT_EQ(ret, CMR_ERROR_NULL_POINTER) << "Normal set user cert status test failed, recode:" << ret; } /** * @tc.name: SetUserCertStatusTest005 * @tc.desc: Test CertManager set user cert status interface Abnormal function * @tc.type: FUNC * @tc.require: AR000H0MJ8 /SR000H09N7 */ HWTEST_F(CmUserCertTest, SetUserCertStatusTest005, TestSize.Level0) { int32_t ret; struct CmBlob certUri = { strlen(g_certStatusExpectResult[1].uri) + 1, reinterpret_cast(g_certStatusExpectResult[1].uri) }; ret = CmSetUserCertStatus(&certUri, 100, true); /* invalid store */ EXPECT_EQ(ret, CM_FAILURE) << "Normal set user cert status test failed, recode:" << ret; } /** * @tc.name: SetUserCertStatusTest006 * @tc.desc: Test CertManager set user cert status interface Abnormal function * @tc.type: FUNC * @tc.require: AR000H0MJ8 /SR000H09N7 */ HWTEST_F(CmUserCertTest, SetUserCertStatusTest006, TestSize.Level0) { int32_t ret; uint8_t invalidUriBuf[] = "invaliduri"; struct CmBlob invalidCertUri = { sizeof(invalidUriBuf), invalidUriBuf }; ret = CmSetUserCertStatus(&invalidCertUri, CM_USER_TRUSTED_STORE, true); EXPECT_EQ(ret, CMR_ERROR_NOT_FOUND) << "Normal set user cert status test failed, recode:" << ret; } /** * @tc.name: SetUserCertStatusTest007 * @tc.desc: Test CertManager update user cert AND set user cert status interface Abnormal function * @tc.type: FUNC * @tc.require: AR000H0MJ8 /SR000H09N7 */ HWTEST_F(CmUserCertTest, SetUserCertStatusTest007, TestSize.Level0) { int32_t ret; uint8_t aliasBuf011[] = "40dc992e"; uint8_t uriBuf024[MAX_URI_LEN] = {0}; struct CmBlob userCertTemp = { sizeof(g_certData01), const_cast(g_certData01) }; struct CmBlob certAliasTemp = { sizeof(aliasBuf011), aliasBuf011 }; struct CmBlob certUri = { sizeof(uriBuf024), uriBuf024 }; ret = CmInstallUserTrustedCert(&userCertTemp, &certAliasTemp, &certUri); /* install */ EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Install test failed, recode:" << ret; ret = CmSetUserCertStatus(&certUri, CM_USER_TRUSTED_STORE, false); /* set status false */ EXPECT_EQ(ret, CM_SUCCESS) << "Normal set user cert status test failed, recode:" << ret; ret = CmInstallUserTrustedCert(&userCertTemp, &certAliasTemp, &certUri); /* update cert */ EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Install test failed, recode:" << ret; struct CertInfo *certInfo007 = nullptr; InitUserCertInfo(&certInfo007); ret = CmGetUserCertInfo(&certUri, CM_USER_TRUSTED_STORE, certInfo007); EXPECT_EQ(ret, CM_SUCCESS) << "Normal get user cert info test failed, recode:" << ret; EXPECT_EQ(true, certInfo007->status); FreeCertInfo(certInfo007); ret = CmUninstallAllUserTrustedCert(); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Uninstall All test failed, recode:" << ret; } /** * @tc.name: SetUserCertStatusTest008 * @tc.desc: Test CertManager set user cert status interface performance * @tc.type: FUNC * @tc.require: AR000H0MJ8 /SR000H09N7 */ HWTEST_F(CmUserCertTest, SetUserCertStatusTest008, TestSize.Level0) { int32_t ret; uint8_t aliasBuf012[] = "1df5a75f"; uint8_t uriBuf025[MAX_URI_LEN] = {0}; struct CmBlob userCert = { sizeof(g_certData03), const_cast(g_certData03) }; struct CmBlob certAlias = { sizeof(aliasBuf012), aliasBuf012 }; struct CmBlob certUri = { sizeof(uriBuf025), uriBuf025 }; ret = CmInstallUserTrustedCert(&userCert, &certAlias, &certUri); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Install test failed, recode:" << ret; for (uint32_t time = 0; time < PERFORMACE_COUNT; time++) { ret = CmSetUserCertStatus(&certUri, CM_USER_TRUSTED_STORE, g_certStatusExpectResult[2].inparamStatus); EXPECT_EQ(ret, CM_SUCCESS) << "Normal set user cert status test failed, recode:" << ret; ret = CmSetUserCertStatus(&certUri, CM_USER_TRUSTED_STORE, true); EXPECT_EQ(ret, CM_SUCCESS) << "Normal set user cert status test failed, recode:" << ret; } ret = CmUninstallUserTrustedCert(&certUri); EXPECT_EQ(ret, CM_SUCCESS) << "Normal user cert Uninstall test failed, recode:" << ret; } }