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
18 * @author Krzysztof Jackiewicz (k.jackiewicz@samsung.com)
24 #include <ckm/ckm-type.h>
25 #include <dpl/exception.h>
26 #include <symbol-visibility.h>
30 class COMMON_API DataType {
34 DECLARE_EXCEPTION_TYPE(CKM::Exception, Base)
35 DECLARE_EXCEPTION_TYPE(Base, OutOfRange)
66 // Special types to support database,
67 DB_KEY_FIRST = KEY_RSA_PUBLIC,
68 DB_KEY_LAST = KEY_AES,
69 DB_CHAIN_FIRST = CHAIN_CERT_0,
70 DB_CHAIN_LAST = CHAIN_CERT_15,
71 DB_FIRST = KEY_RSA_PUBLIC,
72 DB_LAST = CHAIN_CERT_15,
77 explicit DataType(int data);
78 explicit DataType(KeyType key);
79 explicit DataType(AlgoType algorithmType);
80 DataType(const DataType &) = default;
81 DataType& operator=(const DataType &) = default;
83 operator int () const;
84 operator KeyType () const;
85 bool operator==(const DataType &second) const;
88 bool isChainCert() const;
89 bool isKeyPrivate() const;
90 bool isKeyPublic() const;
91 bool isCertificate() const;
92 bool isBinaryData() const;
94 static bool isInRange(int data);
95 static DataType getChainDatatype(unsigned int index);
97 // it's not virtual for a reason!