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>
29 #define EVP_SUCCESS 1 // DO NOTCHANGE THIS VALUE
30 #define EVP_FAIL 0 // DO NOTCHANGE THIS VALUE
32 #define CKM_CRYPTO_INIT_SUCCESS 1
33 #define CKM_CRYPTO_CREATEKEY_SUCCESS 2
34 #define CKM_VERIFY_CHAIN_SUCCESS 5
35 #define NOT_DEFINED -1
42 // During initialization, FIPS_MODE and the entropy source are set
43 // and system certificates are loaded to memory.
44 // FIPS_MODE - ON, OFF(Default)
45 // entropy source - /dev/random,/dev/urandom(Default)
48 TokenPair createKeyPairRSA(CryptoBackend backendId, const int size);
49 TokenPair createKeyPairDSA(CryptoBackend backendId, const int size);
50 TokenPair createKeyPairECDSA(CryptoBackend backendId, ElipticCurve type1);
52 RawBuffer sign(EVP_PKEY *pkey,
53 const CryptoAlgorithm &alg,
54 const RawBuffer &message);
56 int verify(EVP_PKEY *pkey,
57 const CryptoAlgorithm &alg,
58 const RawBuffer &message,
59 const RawBuffer &signature);
61 const EVP_MD *getMdAlgo(const HashAlgorithm hashAlgo);
62 int getRsaPadding(const RSAPaddingAlgorithm padAlgo);
64 RawBuffer signMessage(EVP_PKEY *privKey,
65 const RawBuffer &message,
66 const int rsa_padding);
68 RawBuffer digestSignMessage(EVP_PKEY *privKey,
69 const RawBuffer &message,
70 const EVP_MD *md_algo,
71 const int rsa_padding);
73 int verifyMessage(EVP_PKEY *pubKey,
74 const RawBuffer &message,
75 const RawBuffer &signature,
76 const int rsa_padding);
78 int digestVerifyMessage(EVP_PKEY *pubKey,
79 const RawBuffer &message,
80 const RawBuffer &signature,
81 const EVP_MD *md_algo,
82 const int rsa_padding);
84 } // namespace Internals