Rename DataType::isSKey
[platform/core/security/key-manager.git] / src / manager / common / data-type.h
index ba3c4fd..1866204 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) 2000 - 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *  Copyright (c) 2015 - 2020 Samsung Electronics Co., Ltd All Rights Reserved
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
 #include <ckm/ckm-type.h>
 #include <exception.h>
 #include <symbol-visibility.h>
+#include <dpl/serialization.h>
 
 namespace CKM {
 
-class COMMON_API DataType {
+class COMMON_API DataType final : public ISerializable {
 public:
-
        enum Type {
                KEY_RSA_PUBLIC,
                KEY_RSA_PRIVATE,
@@ -68,31 +68,30 @@ public:
 
        DataType();
        DataType(Type data);
-       explicit DataType(int data);
+
+       explicit DataType(IStream &stream);
+       void Serialize(IStream &stream) const override;
+
        explicit DataType(KeyType key);
-       explicit DataType(AlgoType algorithmType);
        DataType(const DataType &) = default;
        DataType &operator=(const DataType &) = default;
 
-       operator int () const;
-       operator KeyType() const;
-       bool operator==(const DataType &second) const;
+       operator int() const;
 
        bool isKey() const;
-       bool isSKey() const;
+       bool isSymmetricKey() const;
        bool isChainCert() const;
        bool isKeyPrivate() const;
        bool isKeyPublic() const;
        bool isCertificate() const;
        bool isBinaryData() const;
+       bool isEllipticCurve() const;
 
-       static bool isInRange(int data);
        static DataType getChainDatatype(unsigned int index);
 
-       // it's not virtual for a reason!
-       ~DataType() {}
-
 private:
+       void checkRange() const;
+
        Type m_dataType;
 };