diff --git a/cmake/modules/FindBotan.cmake b/cmake/modules/FindBotan.cmake
new file mode 100644
index 00000000..210736d1
--- /dev/null
+++ b/cmake/modules/FindBotan.cmake
@@ -0,0 +1,40 @@
+
+# - Try to find the Gcrypt library
+# Once run this will define
+#
+#  BOTAN_FOUND - set if the system has the gcrypt library
+#  BOTAN_CFLAGS - the required gcrypt compilation flags
+#  BOTAN_LIBRARIES - the linker libraries needed to use the gcrypt library
+#
+# Copyright (c) 2006 Brad Hards <bradh@kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+# libgcrypt is moving to pkg-config, but earlier version don't have it
+
+#search in typical paths for libgcrypt-config
+FIND_PROGRAM(BOTANCONFIG_EXECUTABLE NAMES botan-config PATHS
+   /usr/bin
+   /usr/local/bin
+)
+
+#reset variables
+set(BOTAN_LIBRARIES)
+set(BOTAN_CFLAGS)
+
+# if botan-config has been found
+IF(BOTANCONFIG_EXECUTABLE)
+
+  EXEC_PROGRAM(${BOTANCONFIG_EXECUTABLE} ARGS --libs RETURN_VALUE _return_VALUE OUTPUT_VARIABLE BOTAN_LIBRARIES)
+
+  EXEC_PROGRAM(${BOTANCONFIG_EXECUTABLE} ARGS --cflags RETURN_VALUE _return_VALUE OUTPUT_VARIABLE BOTAN_CFLAGS)
+
+  IF(BOTAN_LIBRARIES)
+    SET(BOTAN_FOUND TRUE)
+    message(STATUS "Found Botan: ${BOTAN_LIBRARIES}")
+  ENDIF(BOTAN_LIBRARIES)
+
+  MARK_AS_ADVANCED(BOTAN_CFLAGS BOTAN_LIBRARIES)
+
+ENDIF(BOTANCONFIG_EXECUTABLE)
diff --git a/cmake/modules/FindNss.cmake b/cmake/modules/FindNss.cmake
index 91062a23..90a077e5 100644
--- a/cmake/modules/FindNss.cmake
+++ b/cmake/modules/FindNss.cmake
@@ -2,7 +2,7 @@
 # Once done this will define
 #
 #  NSS_FOUND - system has mozilla-nss lib
-#  NSS_INCLUDE_DIR - the mozilla-nss include directory
+#  NSS_INCLUDE_DIRS - the mozilla-nss include directories
 #  NSS_LIBRARIES - Link these to use mozilla-nss
 #  NSS_DEFINITIONS - Compiler switches required for using NSS
 #
@@ -11,37 +11,24 @@
 # Redistribution and use is allowed according to the terms of the BSD license.
 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
 
-if (NSS_INCLUDE_DIR AND NSS_LIBRARIES)
+if (NSS_INCLUDE_DIRS AND NSS_LIBRARIES)
 
   # in cache already
   SET(NSS_FOUND TRUE)
 
-else (NSS_INCLUDE_DIR AND NSS_LIBRARIES)
+else (NSS_INCLUDE_DIRS AND NSS_LIBRARIES)
 
-  # use pkg-config to get the directories and then use these values
-  # in the FIND_PATH() and FIND_LIBRARY() calls
   INCLUDE(UsePkgConfig)
-  
-  PKGCONFIG(mozilla-nss _NSSIncDir _NSSLinkDir _NSSLinkFlags _NSSCflags)
-  
-  set(NSS_DEFINITIONS ${_NSSCflags})
 
-  FIND_PATH(NSS_INCLUDE_DIR nss/pk11func.h
-    ${_NSSIncDir}
-    /usr/include
-    /usr/local/include
-  )
+  PKGCONFIG(nss _NSSIncDir _NSSLinkDir _NSSLinkFlags _NSSCflags)
+
+  set(NSS_DEFINITIONS ${_NSSCflags})
+  set(NSS_INCLUDE_DIRS ${_NSSIncDir})
+  set(NSS_LIBRARIES ${_NSSLinkFlags})
   
-  FIND_LIBRARY(NSS_LIBRARIES NAMES nss3
-    PATHS
-    ${_NSSLinkDir}
-    /usr/lib
-    /usr/local/lib
-  )
-  
-  if (NSS_INCLUDE_DIR AND NSS_LIBRARIES)
+  if (NSS_INCLUDE_DIRS AND NSS_LIBRARIES)
      set(NSS_FOUND TRUE)
-  endif (NSS_INCLUDE_DIR AND NSS_LIBRARIES)
+  endif (NSS_INCLUDE_DIRS AND NSS_LIBRARIES)
   
   if (NSS_FOUND)
     if (NOT NSS_FIND_QUIETLY)
@@ -53,6 +40,6 @@ else (NSS_INCLUDE_DIR AND NSS_LIBRARIES)
     endif (NSS_FIND_REQUIRED)
   endif (NSS_FOUND)
   
-  MARK_AS_ADVANCED(NSS_INCLUDE_DIR NSS_LIBRARIES)
+  MARK_AS_ADVANCED(NSS_INCLUDE_DIRS NSS_LIBRARIES)
   
-endif (NSS_INCLUDE_DIR AND NSS_LIBRARIES)
+endif (NSS_INCLUDE_DIRS AND NSS_LIBRARIES)