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
24 #include <certificate-impl.h>
25 #include <ckm/ckm-type.h>
26 #include <openssl/evp.h>
28 #define EVP_SUCCESS 1 // DO NOTCHANGE THIS VALUE
29 #define EVP_FAIL 0 // DO NOTCHANGE THIS VALUE
31 #define CKM_CRYPTO_INIT_SUCCESS 1
32 #define CKM_CRYPTO_CREATEKEY_SUCCESS 2
33 #define CKM_VERIFY_CHAIN_SUCCESS 5
34 #define NOT_DEFINED -1
43 void createKeyPairRSA(const int size,
44 KeyImpl &createdPrivateKey,
45 KeyImpl &createdPublicKey);
47 void createKeyPairDSA(const int size,
48 KeyImpl &createdPrivateKey,
49 KeyImpl &createdPublicKey);
51 void createKeyPairECDSA(ElipticCurve type1,
52 KeyImpl &createdPrivateKey,
53 KeyImpl &createdPublicKey);
55 RawBuffer sign(EVP_PKEY *pkey,
56 const CryptoAlgorithm &alg,
57 const RawBuffer &message);
59 int verify(EVP_PKEY *pkey,
60 const CryptoAlgorithm &alg,
61 const RawBuffer &message,
62 const RawBuffer &signature);
64 const EVP_MD *getMdAlgo(const HashAlgorithm hashAlgo);
65 int getRsaPadding(const RSAPaddingAlgorithm padAlgo);
67 RawBuffer signMessage(EVP_PKEY *privKey,
68 const RawBuffer &message,
69 const int rsa_padding);
71 RawBuffer digestSignMessage(EVP_PKEY *privKey,
72 const RawBuffer &message,
73 const EVP_MD *md_algo,
74 const int rsa_padding);
76 int verifyMessage(EVP_PKEY *pubKey,
77 const RawBuffer &message,
78 const RawBuffer &signature,
79 const int rsa_padding);
81 int digestVerifyMessage(EVP_PKEY *pubKey,
82 const RawBuffer &message,
83 const RawBuffer &signature,
84 const EVP_MD *md_algo,
85 const int rsa_padding);
87 } // namespace Internals