diff --git a/zh-cn/native_sdk/xts/device_attest/attest_result_info.h b/zh-cn/native_sdk/xts/device_attest/attest_result_info.h new file mode 100644 index 0000000000000000000000000000000000000000..d1f8df65a50b718d7054ea0c3a294a4e442ee892 --- /dev/null +++ b/zh-cn/native_sdk/xts/device_attest/attest_result_info.h @@ -0,0 +1,49 @@ +/* + * 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. + */ +#ifndef ATTEST_RESULT_INFO_H +#define ATTEST_RESULT_INFO_H + +#include "parcel.h" +#include +#include + +#define MaxDetailSize 5 + +typedef enum { + ATTEST_RESULT_AUTH = 0, + ATTEST_RESULT_SOFTWARE, + ATTEST_RESULT_VERSIONID, + ATTEST_RESULT_PATCHLEVEL, + ATTEST_RESULT_ROOTHASH, + ATTEST_RESULT_PCID, + ATTEST_RESULT_MAX, +} ATTEST_RESULT_TYPE_2; + +namespace OHOS { +namespace DevAttest { +class AttestResultInfo : public Parcelable { +public: + int32_t authResult_ = -1; + int32_t softwareResult_ = -1; + std::vector softwareResultDetail_ = {-1, -1, -1, -1, -1}; + int32_t ticketLength_ = 0; + std::string ticket_; + + virtual bool Marshalling(Parcel &parcel) const override; + static sptr Unmarshalling(Parcel &parcel); +}; +} // end of DevAttest +} // end of OHOS +#endif \ No newline at end of file diff --git a/zh-cn/native_sdk/xts/device_attest/devattest_client.h b/zh-cn/native_sdk/xts/device_attest/devattest_client.h new file mode 100644 index 0000000000000000000000000000000000000000..c18b043ce066c7a9f426af13620d2005bb7dd228 --- /dev/null +++ b/zh-cn/native_sdk/xts/device_attest/devattest_client.h @@ -0,0 +1,41 @@ +/* + * 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. + */ + +#ifndef DEVATTEST_CLIENT_H +#define DEVATTEST_CLIENT_H + +#include +#include "iremote_object.h" +#include "devattest_interface.h" +#include "singleton.h" + +namespace OHOS { +namespace DevAttest { +class DevAttestClient { + DECLARE_DELAYED_SINGLETON(DevAttestClient) + +public: + int GetAttestStatus(AttestResultInfo &attestResultInfo); + +private: + DevAttestClient(const DevAttestClient&); + DevAttestClient& operator=(const DevAttestClient&); + int InitClientService(); + + sptr attestClientInterface_; +}; +} // end of DevAttest +} // end of OHOS +#endif \ No newline at end of file diff --git a/zh-cn/native_sdk/xts/device_attest/devattest_interface.h b/zh-cn/native_sdk/xts/device_attest/devattest_interface.h new file mode 100644 index 0000000000000000000000000000000000000000..fde7224ec8eed5e103979c3a98f9912c05664c1c --- /dev/null +++ b/zh-cn/native_sdk/xts/device_attest/devattest_interface.h @@ -0,0 +1,37 @@ +/* + * 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. + */ + +#ifndef DEVATTEST_INTERFACE_H +#define DEVATTEST_INTERFACE_H + +#include +#include "iremote_broker.h" +#include "attest_result_info.h" + +namespace OHOS { +namespace DevAttest { +class DevAttestInterface : public OHOS::IRemoteBroker { +public: + DECLARE_INTERFACE_DESCRIPTOR(u"ohos.DevAttest.DevAttestInterface"); + + virtual int32_t GetAttestStatus(AttestResultInfo &attestResultInfo) = 0; + + enum { + GET_AUTH_RESULT = 0, + }; +}; +} // end of DevAttest +} // end of OHOS +#endif \ No newline at end of file diff --git a/zh-cn/native_sdk/xts/device_attest/devattest_service_proxy.h b/zh-cn/native_sdk/xts/device_attest/devattest_service_proxy.h new file mode 100644 index 0000000000000000000000000000000000000000..4f17f55b8b76028f5d36246c4a53c1366a88985a --- /dev/null +++ b/zh-cn/native_sdk/xts/device_attest/devattest_service_proxy.h @@ -0,0 +1,37 @@ +/* + * 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. + */ + +#ifndef DEVATTEST_SERVICE_PROXY_H +#define DEVATTEST_SERVICE_PROXY_H + +#include +#include "iremote_proxy.h" +#include "devattest_interface.h" + +namespace OHOS { +namespace DevAttest { +class DevAttestServiceProxy : public IRemoteProxy { +public: + explicit DevAttestServiceProxy(const sptr &impl) + : IRemoteProxy(impl) {} + ~DevAttestServiceProxy() {} + + int32_t GetAttestStatus(AttestResultInfo &attestResultInfo) override; +private: + static inline BrokerDelegator delegator_; +}; +} // end of DevAttest +} // end of OHOS +#endif \ No newline at end of file