updated with support for openssl 1.1.1, which is a bit premature
[feisty_meow.git] / nucleus / library / crypto / rsa_crypto.h
index e43f1bdb7e5632f0762ab1a8864afd3136f68077..eb642caef45d0c47e84535a68cad9d212233885d 100644 (file)
 #include <basis/byte_array.h>
 #include <basis/contracts.h>
 
+#include <openssl/rsa.h>
+
 // forward.
-struct rsa_st;
+//struct RSA;
 
 namespace crypto {
 
@@ -43,7 +45,7 @@ public:
     is a public key, then only the public_encryption and public_decryption
     methods will be available. */
 
-  rsa_crypto(rsa_st *key);
+  rsa_crypto(RSA *key);
     //!< starts with a pre-existing "key" in the low-level form.
 
   rsa_crypto(const rsa_crypto &to_copy);
@@ -60,11 +62,11 @@ public:
     is destructively consumed during the set method; do not pass in your
     only copy. */
 
-  bool set_key(rsa_st *key);
+  bool set_key(RSA *key);
     //!< sets our new "key".
     /*!< this must be a valid key created via the RSA algorithms. */
 
-  bool check_key(rsa_st *key);
+  bool check_key(RSA *key);
     //!< checks the RSA "key" provided for validity.
 
   bool public_encrypt(const basis::byte_array &source, basis::byte_array &target) const;
@@ -89,11 +91,11 @@ public:
     //!< makes a copy of the private key held here.
     /*!< the private key should never be exposed to anyone else. */
 
-  static rsa_st *generate_key(int key_size);
+  static RSA *generate_key(int key_size);
     //!< creates a random RSA key using the lower-level openssl methods.
 
 private:
-  rsa_st *_key;  //!< our internal key.
+  RSA *_key;  //!< our internal key.
 };
 
 } //namespace.