Update copyrights to 2012 for files modified this year
[novacoin.git] / src / key.h
index c43e4ee..8b033a0 100644 (file)
--- a/src/key.h
+++ b/src/key.h
@@ -1,13 +1,21 @@
 // Copyright (c) 2009-2010 Satoshi Nakamoto
+// Copyright (c) 2009-2012 The Bitcoin developers
 // Distributed under the MIT/X11 software license, see the accompanying
 // file license.txt or http://www.opensource.org/licenses/mit-license.php.
 #ifndef BITCOIN_KEY_H
 #define BITCOIN_KEY_H
 
+#include <stdexcept>
+#include <vector>
+
 #include <openssl/ec.h>
 #include <openssl/ecdsa.h>
 #include <openssl/obj_mac.h>
 
+#include "serialize.h"
+#include "uint256.h"
+#include "base58.h"
+
 // secp160k1
 // const unsigned int PRIVATE_KEY_SIZE = 192;
 // const unsigned int PUBLIC_KEY_SIZE  = 41;
@@ -220,6 +228,22 @@ public:
             return false;
         return true;
     }
+
+    CBitcoinAddress GetAddress() const
+    {
+        return CBitcoinAddress(GetPubKey());
+    }
+
+    bool IsValid()
+    {
+        if (!fSet)
+            return false;
+
+        CSecret secret = GetSecret();
+        CKey key2;
+        key2.SetSecret(secret);
+        return GetPubKey() == key2.GetPubKey();
+    }
 };
 
 #endif