2 * Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License
23 #include <ckm/ckm-type.h>
24 #include <openssl/evp.h>
25 #include <sw-backend/obj.h>
32 // TODO replace it with DataContainer
38 typedef std::pair<Data, Data> DataPair;
40 DataPair generateAKey(const CryptoAlgorithm &algorithm);
41 Data generateSKey(const CryptoAlgorithm &algorithm);
43 RawBuffer symmetricEncrypt(
45 const CryptoAlgorithm &alg,
46 const RawBuffer &data);
47 RawBuffer symmetricDecrypt(
49 const CryptoAlgorithm &alg,
50 const RawBuffer &cipher);
51 RawBuffer asymmetricEncrypt(
53 const CryptoAlgorithm &alg,
54 const RawBuffer &data);
55 RawBuffer asymmetricDecrypt(
57 const CryptoAlgorithm &alg,
58 const RawBuffer &data);
60 std::pair<RawBuffer, RawBuffer> encryptDataAesGcm(
62 const RawBuffer &data,
65 const RawBuffer &aad = RawBuffer());
67 RawBuffer decryptDataAesGcm(
69 const RawBuffer &data,
72 const RawBuffer &aad = RawBuffer());
74 RawBuffer encryptDataAes(AlgoType type,
76 const RawBuffer &data,
79 RawBuffer decryptDataAes(AlgoType type,
81 const RawBuffer &data,
84 RawBuffer sign(EVP_PKEY *pkey,
85 const CryptoAlgorithm &alg,
86 const RawBuffer &message);
88 int verify(EVP_PKEY *pkey,
89 const CryptoAlgorithm &alg,
90 const RawBuffer &message,
91 const RawBuffer &signature);
93 Data deriveECDH(const EvpShPtr &pkey, const CryptoAlgorithm &alg);
95 } // namespace Internals