3

I am using windows 8 and python 3.6.1 I've done the following command in my cmd:

pip install cryptoshop

However, when I run the following python code:

from cryptoshop import encryptfile
from cryptoshop import decryptfile

result1 = encryptfile(filename="test", passphrase="mypassphrase", algo="srp")
print(result1)

result2 = decryptfile(filename="test.cryptoshop", passphrase="mypassphrase")
print(result2)

I get the following error:

Traceback (most recent call last): File "C:/Users/Owner/Desktop/test.py", line 1, in from cryptoshop import encryptfile File "C:\Users\Owner\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cryptoshop__init__.py", line 26, in from cryptoshop.cryptoshop import encryptfile File "C:\Users\Owner\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cryptoshop\cryptoshop.py", line 56, in from ._cascade_engine import encry_decry_cascade File "C:\Users\Owner\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cryptoshop_cascade_engine.py", line 27, in from ._nonce_engine import generate_nonce_timestamp File "C:\Users\Owner\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cryptoshop_nonce_engine.py", line 39, in import botan ModuleNotFoundError: No module named 'botan'

Now, I obviously know that you must install botan into python in order to use it. However, this is where I am running into an issue. I've downloaded Botan from this link as instructed:

https://github.com/randombit/botan

And then I've followed these instructions in an attempt to install Botan:

./configure.py [--prefix=/some/directory]
make
make install

However, when I type make into the command line I get an error saying there is no such command. And then when I go to run my above Python code I still get the no module Botan error. So obviously I am doing something run. How can I properly install Botan into my Python 3.6 directories so that I can use cryptoshop.

I've also attempted to do pip install Botan, as that is how I've installed so many other python libraries but that has been unsuccessful as well.

tgrim90
  • 339
  • 1
  • 2
  • 13

2 Answers2

4

make is a linux command

According to the botan website you can use nmake as a replacement on windows ( http://wiki.c2.com/?UsingNmake ) :

On Windows

You need to have a copy of Python installed, and have both Python and your chosen compiler in your path. Open a command shell (or the SDK shell), and run:

  $ python configure.py --cc=msvc (or --cc=gcc for MinGW) [--cpu=CPU] 
  $ nmake 
  $ botan-test.exe 
  $ nmake install

Botan supports the nmake replacement Jom which enables you to run multiple build jobs in parallel.

source : https://botan.randombit.net/manual/building.html

ralf htp
  • 9,149
  • 4
  • 22
  • 34
  • when i run these exact commands i still get nmake is not recognized. I ran the following at the location of my botan install. python configure.py --cc=msvc [--cpu=CPU] then ran nmake and got the error – tgrim90 Oct 03 '17 at 20:49
  • 1
    You forgot to mention that `nmake` requires visual C++ to be installed to work in a windows machine. @tgrim90 make sure you Visual C++ installed in your windows machine – aspo Oct 03 '17 at 20:59
  • @deaspo is there an easy way to do this? – tgrim90 Oct 03 '17 at 21:01
  • @tgrim90 you can just install the SDK, Microsoft Visual C++ Redistributable for Visual Studio 2017, without having to install the whole Visual Studio. It contains all the needed components. Other option is to run the code in Ubuntu – aspo Oct 03 '17 at 21:10
  • @deaspo ok so i did that i downloaded this: Microsoft Visual C++ Redistributable for Visual Studio 2017. And then installed it and tried to run the above code in the command line and still get nmake is not recognizable – tgrim90 Oct 03 '17 at 21:13
  • Are you running the command in a command shell that was packaged with the SDK or just the general Windows Command prompt? – aspo Oct 03 '17 at 21:15
  • @deaspo I also get an error with [--cpu=CPU] am i doing something wrong there as well? – tgrim90 Oct 03 '17 at 21:15
  • just windows command prompt i cannot find an shell packaged with the sdk or the install. where does visual c++ usually install? – tgrim90 Oct 03 '17 at 21:16
  • In the start menu, after restarting the machine there should be `visual c++ 20XX XX-bit command prompt` – aspo Oct 03 '17 at 21:21
  • Edit your post? – LW001 Oct 03 '17 at 21:30
  • @deaspo so where would I find the shell packaged with the sdk on windows 8. – tgrim90 Oct 03 '17 at 21:51
  • Search in start for Visual C++ ...... One of the options should be Visual C++ 20XX XX-bit Command Prompt. That is if you already installed it – aspo Oct 03 '17 at 21:55
  • @deaspo I have already installed it, it shows up in my programs and features on my control panel, however it does not show up when i search for it – tgrim90 Oct 03 '17 at 21:57
  • Here is the correct link http://landinghub.visualstudio.com/visual-cpp-build-tools – aspo Oct 03 '17 at 22:00
  • @deaspo do i download for 2015 or 2017? – tgrim90 Oct 03 '17 at 22:00
  • @tgrim90 sorry about the earlier link – aspo Oct 03 '17 at 22:00
  • Any would do, yoo just want to use the `nmake` tool which is built into both – aspo Oct 03 '17 at 22:01
  • @deaspo and what exactly should I be downloading, I assume the performance tools that include a standalone command prompt? but i'm not sure – tgrim90 Oct 03 '17 at 22:02
  • @deaspo sorry, but it won't let me download just the tools it seems to make me download vs as well – tgrim90 Oct 03 '17 at 22:05
  • @deaspo nevermind now after 25 tries it let me download it – tgrim90 Oct 03 '17 at 22:07
  • @deaspo downloaded Performance Tools for Visual Studio, went through the install, restarted my machine, searched for visual c++ and still not showing up. is there a folder on my machine i could look for the command prompt on? – tgrim90 Oct 03 '17 at 22:15
  • See the following: https://superuser.com/questions/146577/where-do-i-find-nmake-for-windows-7-x64 , https://stackoverflow.com/questions/19041439/vs2012-nmake-is-not-recognized-as-an-internal-or-external-command , https://stackoverflow.com/questions/35507646/nmake-exe-is-not-found-in-the-windows-system32-folder-how-to-setup-nmake-comman – aspo Oct 05 '17 at 01:23
1

For completeness, here's how I made it work on a Mac

Assuming you have brew installed.

brew install botan

You may need to install other functionality first:

brew install gmp
brew install mpfr
brew install mpc

Find out where botan got installed with brew info botan. My location is /usr/local/Cellar/botan/2.6.0

In that folder, you'll find lib/python2.7/site-packages, copy the contents of this folder into your Python's installation site-packages folder.

Note 1: At the time of this writing, only python 2.7 seems to be supported, but I'm using python 3.6 and everything seems to be working.

Note 2: If the file is called botan2.py, you may need to rename it to botan.py in your python's site-packages folder.

Joao Coelho
  • 2,838
  • 4
  • 30
  • 36