diff --git a/python/opendht.pyx b/python/opendht.pyx
index 024ac9b030769804ff955cdf087a05651458dc4d..d5aa961708a4bba8f61c6dd1dc5fd45468c51043 100644
--- a/python/opendht.pyx
+++ b/python/opendht.pyx
@@ -267,6 +267,11 @@ cdef class PrivateKey(_WithID):
         k = PrivateKey()
         k._key = cpp.make_shared[cpp.PrivateKey](cpp.PrivateKey.generate())
         return k
+    @staticmethod
+    def generateEC():
+        k = PrivateKey()
+        k._key = cpp.make_shared[cpp.PrivateKey](cpp.PrivateKey.generateEC())
+        return k
 
 cdef class PublicKey(_WithID):
     cdef cpp.PublicKey _key
diff --git a/python/opendht_cpp.pxd b/python/opendht_cpp.pxd
index 9cf1330e0b7af9bb0bd658b18dbc3fdfd330aa7a..60c23dada1d6a98b9a2db29eb6ffd10f65210d7a 100644
--- a/python/opendht_cpp.pxd
+++ b/python/opendht_cpp.pxd
@@ -89,6 +89,8 @@ cdef extern from "opendht/crypto.h" namespace "dht::crypto":
         Blob decrypt(Blob data) const
         @staticmethod
         PrivateKey generate()
+        @staticmethod
+        PrivateKey generateEC()
 
     cdef cppclass PublicKey:
         PublicKey()