2 * Copyright (c) 2000 - 2019 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 <exception.h>
26 #include <symbol-visibility.h>
30 class COMMON_API DataType {
60 // Special types to support database,
61 DB_KEY_FIRST = KEY_RSA_PUBLIC,
62 DB_KEY_LAST = KEY_AES,
63 DB_CHAIN_FIRST = CHAIN_CERT_0,
64 DB_CHAIN_LAST = CHAIN_CERT_15,
65 DB_FIRST = KEY_RSA_PUBLIC,
66 DB_LAST = CHAIN_CERT_15,
71 explicit DataType(int data);
72 explicit DataType(KeyType key);
73 DataType(const DataType &) = default;
74 DataType &operator=(const DataType &) = default;
76 operator int () const;
77 operator KeyType() const;
78 bool operator==(const DataType &second) const;
82 bool isChainCert() const;
83 bool isKeyPrivate() const;
84 bool isKeyPublic() const;
85 bool isCertificate() const;
86 bool isBinaryData() const;
87 bool isEllipticCurve() const;
89 static bool isInRange(int data);
90 static DataType getChainDatatype(unsigned int index);
92 // it's not virtual for a reason!