1 /* 2 * Copyright (c) 2025-2025 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #include "ani_sym_key.h" 17 18 using namespace taihe; 19 using namespace ohos::security::cryptoFramework::cryptoFramework; 20 using namespace ANI::CryptoFramework; 21 22 namespace ANI::CryptoFramework { SymKeyImpl()23SymKeyImpl::SymKeyImpl() : symKey(nullptr) {} 24 SymKeyImpl(HcfSymKey * obj)25SymKeyImpl::SymKeyImpl(HcfSymKey *obj) : symKey(obj) {} 26 ~SymKeyImpl()27SymKeyImpl::~SymKeyImpl() 28 { 29 HcfObjDestroy(symKey); 30 symKey = nullptr; 31 } 32 ClearMem()33void SymKeyImpl::ClearMem() 34 { 35 TH_THROW(std::runtime_error, "ClearMem not implemented"); 36 } 37 GetSymKeyObj()38int64_t SymKeyImpl::GetSymKeyObj() 39 { 40 return reinterpret_cast<int64_t>(symKey); 41 } 42 GetEncoded()43DataBlob SymKeyImpl::GetEncoded() 44 { 45 TH_THROW(std::runtime_error, "GetEncoded not implemented"); 46 } 47 GetFormat()48string SymKeyImpl::GetFormat() 49 { 50 TH_THROW(std::runtime_error, "GetFormat not implemented"); 51 } 52 GetAlgName()53string SymKeyImpl::GetAlgName() 54 { 55 TH_THROW(std::runtime_error, "GetAlgName not implemented"); 56 } 57 } // namespace ANI::CryptoFramework 58