diff --git a/rsa-decrypt.c b/rsa-decrypt.c
index dfdf089f8f91d292c502914efff8e29f9b1489de..41f720a056ef3a2915116b8030c64f8b94fe01a7 100644
--- a/rsa-decrypt.c
+++ b/rsa-decrypt.c
@@ -23,6 +23,12 @@
  * MA 02111-1307, USA.
  */
 
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#if WITH_PUBLIC_KEY
+
 #include "rsa.h"
 
 #include "bignum.h"
@@ -73,3 +79,5 @@ rsa_decrypt(const struct rsa_private_key *key,
 
   return 1;
 }
+
+#endif /* WITH_PUBLIC_KEY */
diff --git a/rsa-encrypt.c b/rsa-encrypt.c
index ef2e72f31129c0dba5aef83ea95ae432dc4c8b5b..66a08c0fabf7c8f4b6a8c3c699cc7af82ec257b4 100644
--- a/rsa-encrypt.c
+++ b/rsa-encrypt.c
@@ -23,6 +23,12 @@
  * MA 02111-1307, USA.
  */
 
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#if WITH_PUBLIC_KEY
+
 #include "rsa.h"
 
 #include "bignum.h"
@@ -75,3 +81,5 @@ rsa_encrypt(const struct rsa_public_key *key,
 
   return 1;  
 }
+
+#endif /* WITH_PUBLIC_KEY */