Topic: SSL connection is failing with error "No shared cipher"

I am having Openssl based Client and Server in python. I am able to communicate between these scripts without any issue. But when I replace the python client with my hardware device (which is successfully connecting to the Azure network), I am getting an error as "No shared cipher".

Using Wireshark I did some analysis. In a successful connection scenario, the Server is using Cipher suite 0xC030(observed from Server Hello). Which is not enabled in my hardware. I want to know how to enable a cipher in the Wolfssl library.

Share

Re: SSL connection is failing with error "No shared cipher"

Hello teja.veeragandam,

Could you tell us more about the hardware device you are using? Are you currently using openSSL and wish to replace it with wolfSSL?

Here are some good references for getting started:
https://www.wolfssl.com/docs/wolfssl-manual/ch2/

Thanks,
Eric @ wolfSSL Support

3 (edited by teja.veeragandam 2021-01-23 07:11:58)

Re: SSL connection is failing with error "No shared cipher"

In my hardware I am using Wolfssl in C.

I tried to install Wolfssl python library using the given commands in the below link but failed to install due to unknown issues. So I wrote my server using OpenSSL (I am ready to come back to Wolfssl if you help me in installing)

https://github.com/wolfSSL/wolfssl-py

The software that I am using on my device is able to communicate with Azure cloud without any issues. The only change I have done to my working software is the IP address to which it has to contact. So I feel that there are no issues with my device software.

I tried to print the Ciphers supported by the Server using the below command "print(context.get_ciphers())" and the result is attached

And the ciphers that my hardware device is supporting is attached. Can you please help how to add more Ciphers to my device?
In the link you mentioned, it looks very easy to remove/add features. But in code, it looks very hard.

Please help me in resolving the issue.

Post's attachments

Ciphers.zip 125.38 kb, 1 downloads since 2021-01-23 

You don't have the permssions to download the attachments of this post.

Share

Re: SSL connection is failing with error "No shared cipher"

What errors did you see when trying to install the wolfssl-py library?

Enabling the ciphers in wolfSSL will not enable them openSSL, so you'll need to be using wolfSSL for us to help.

Re: SSL connection is failing with error "No shared cipher"

Please find error below

$ pip install .
Processing c:\git\wolfssl-py
Requirement already satisfied: cffi in c:\programs\python\python371\lib\site-packages (from wolfssl==4.1.0.post0) (1.14.0)
Requirement already satisfied: pycparser in c:\programs\python\python371\lib\site-packages (from cffi->wolfssl==4.1.0.post0) (2.20)
Building wheels for collected packages: wolfssl
  Building wheel for wolfssl (setup.py): started
  Building wheel for wolfssl (setup.py): finished with status 'error'
  ERROR: Command errored out with exit status 1:
   command: 'c:\programs\python\python371\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\909011\\AppData\\Local\\Temp\\pip-req-build-20hrf96l\\setup.py'"'"'; __file__='"'"'C:\\Users\\909011\\AppData\\Local\\Temp\\pip-req-build-20hrf96l\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\909011\AppData\Local\Temp\pip-wheel-hhbfpueu'
       cwd: C:\Users\909011\AppData\Local\Temp\pip-req-build-20hrf96l\
  Complete output (96 lines):
  c:\programs\python\python371\lib\site-packages\setuptools\dist.py:452: UserWarning: Normalizing '4.1.0-0' to '4.1.0.post0'
    warnings.warn(tmpl.format(**locals()))
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.7
  creating build\lib.win-amd64-3.7\wolfssl
  copying C:\Users\909011\AppData\Local\Temp\pip-req-build-20hrf96l\src\wolfssl\exceptions.py -> build\lib.win-amd64-3.7\wolfssl
  copying C:\Users\909011\AppData\Local\Temp\pip-req-build-20hrf96l\src\wolfssl\utils.py -> build\lib.win-amd64-3.7\wolfssl
  copying C:\Users\909011\AppData\Local\Temp\pip-req-build-20hrf96l\src\wolfssl\_build_ffi.py -> build\lib.win-amd64-3.7\wolfssl
  copying C:\Users\909011\AppData\Local\Temp\pip-req-build-20hrf96l\src\wolfssl\_build_wolfssl.py -> build\lib.win-amd64-3.7\wolfssl
  copying C:\Users\909011\AppData\Local\Temp\pip-req-build-20hrf96l\src\wolfssl\_methods.py -> build\lib.win-amd64-3.7\wolfssl
  copying C:\Users\909011\AppData\Local\Temp\pip-req-build-20hrf96l\src\wolfssl\__about__.py -> build\lib.win-amd64-3.7\wolfssl
  copying C:\Users\909011\AppData\Local\Temp\pip-req-build-20hrf96l\src\wolfssl\__init__.py -> build\lib.win-amd64-3.7\wolfssl
  running build_ext
  generating cffi module 'build\\temp.win-amd64-3.7\\Release\\wolfssl._ffi.c'
  creating build\temp.win-amd64-3.7
  creating build\temp.win-amd64-3.7\Release
  Cloning into 'C:\Users\909011\AppData\Local\Temp\pip-req-build-20hrf96l\lib\wolfssl\src'...
  Note: checking out '50fbdb961fd8c2d8123064e567ae8ec44167732d'.

  You are in 'detached HEAD' state. You can look around, make experimental
  changes and commit them, and you can discard any commits you make in this
  state without impacting any branches by performing another checkout.

  If you want to create a new branch to retain commits you create, you may
  do so (now or later) by using -b with the checkout command again. Example:

    git checkout -b <new-branch-name>

  Checking out files: 100% (1566/1566), done.
  '.' is not recognized as an internal or external command,
  operable program or batch file.
  'libtoolize' is not recognized as an internal or external command,
  operable program or batch file.
  Traceback (most recent call last):
    File "C:\Users\909011\AppData\Local\Temp\pip-req-build-20hrf96l\src\wolfssl\_build_wolfssl.py", line 171, in make
      call("./autogen.sh")
    File "C:\Users\909011\AppData\Local\Temp\pip-req-build-20hrf96l\src\wolfssl\_build_wolfssl.py", line 69, in call
      subprocess.check_call(cmd, shell=True, env=os.environ)
    File "c:\programs\python\python371\lib\subprocess.py", line 341, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command './autogen.sh' returned non-zero exit status 1.

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "C:\Users\909011\AppData\Local\Temp\pip-req-build-20hrf96l\setup.py", line 116, in <module>
      cmdclass={"build_ext" : cffiBuilder}
    File "c:\programs\python\python371\lib\site-packages\setuptools\__init__.py", line 153, in setup
      return distutils.core.setup(**attrs)
    File "c:\programs\python\python371\lib\distutils\core.py", line 148, in setup
      dist.run_commands()
    File "c:\programs\python\python371\lib\distutils\dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "c:\programs\python\python371\lib\distutils\dist.py", line 985, in run_command
      cmd_obj.run()
    File "c:\programs\python\python371\lib\site-packages\wheel\bdist_wheel.py", line 299, in run
      self.run_command('build')
    File "c:\programs\python\python371\lib\distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "c:\programs\python\python371\lib\distutils\dist.py", line 985, in run_command
      cmd_obj.run()
    File "c:\programs\python\python371\lib\distutils\command\build.py", line 135, in run
      self.run_command(cmd_name)
    File "c:\programs\python\python371\lib\distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "c:\programs\python\python371\lib\distutils\dist.py", line 985, in run_command
      cmd_obj.run()
    File "c:\programs\python\python371\lib\site-packages\cffi\setuptools_ext.py", line 142, in run
      base_class.run(self)
    File "c:\programs\python\python371\lib\site-packages\setuptools\command\build_ext.py", line 79, in run
      _build_ext.run(self)
    File "c:\programs\python\python371\lib\distutils\command\build_ext.py", line 339, in run
      self.build_extensions()
    File "c:\programs\python\python371\lib\distutils\command\build_ext.py", line 448, in build_extensions
      self._build_extensions_serial()
    File "c:\programs\python\python371\lib\distutils\command\build_ext.py", line 473, in _build_extensions_serial
      self.build_extension(ext)
    File "C:\Users\909011\AppData\Local\Temp\pip-req-build-20hrf96l\setup.py", line 76, in build_extension
      build_wolfssl(wolfssl.__wolfssl_version__)
    File "C:\Users\909011\AppData\Local\Temp\pip-req-build-20hrf96l\src\wolfssl\_build_wolfssl.py", line 189, in build_wolfssl
      make(make_flags(prefix))
    File "C:\Users\909011\AppData\Local\Temp\pip-req-build-20hrf96l\src\wolfssl\_build_wolfssl.py", line 173, in make
      call("libtoolize")
    File "C:\Users\909011\AppData\Local\Temp\pip-req-build-20hrf96l\src\wolfssl\_build_wolfssl.py", line 69, in call
      subprocess.check_call(cmd, shell=True, env=os.environ)
    File "c:\programs\python\python371\lib\subprocess.py", line 341, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command 'libtoolize' returned non-zero exit status 1.
  Calling: 'git clone --depth=1 --branch=v4.1.0-stable [url]https://github.com/wolfssl/wolfssl.git[/url] C:\Users\909011\AppData\Local\Temp\pip-req-build-20hrf96l\lib\wolfssl\src' from working directory C:\Users\909011\AppData\Local\Temp\pip-req-build-20hrf96l
  Calling: 'git clean -fdX' from working directory C:\Users\909011\AppData\Local\Temp\pip-req-build-20hrf96l\lib\wolfssl\src
  Calling: './autogen.sh' from working directory C:\Users\909011\AppData\Local\Temp\pip-req-build-20hrf96l\lib\wolfssl\src
  Calling: 'libtoolize' from working directory C:\Users\909011\AppData\Local\Temp\pip-req-build-20hrf96l\lib\wolfssl\src
  ----------------------------------------
  ERROR: Failed building wheel for wolfssl
  Running setup.py clean for wolfssl
Failed to build wolfssl
Installing collected packages: wolfssl
    Running setup.py install for wolfssl: started
    Running setup.py install for wolfssl: finished with status 'error'
    ERROR: Command errored out with exit status 1:
     command: 'c:\programs\python\python371\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\909011\\AppData\\Local\\Temp\\pip-req-build-20hrf96l\\setup.py'"'"'; __file__='"'"'C:\\Users\\909011\\AppData\\Local\\Temp\\pip-req-build-20hrf96l\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\909011\AppData\Local\Temp\pip-record-zm54dsme\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\programs\python\python371\Include\wolfssl'
         cwd: C:\Users\909011\AppData\Local\Temp\pip-req-build-20hrf96l\
    Complete output (84 lines):
    c:\programs\python\python371\lib\site-packages\setuptools\dist.py:452: UserWarning: Normalizing '4.1.0-0' to '4.1.0.post0'
      warnings.warn(tmpl.format(**locals()))
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.7
    creating build\lib.win-amd64-3.7\wolfssl
    copying C:\Users\909011\AppData\Local\Temp\pip-req-build-20hrf96l\src\wolfssl\exceptions.py -> build\lib.win-amd64-3.7\wolfssl
    copying C:\Users\909011\AppData\Local\Temp\pip-req-build-20hrf96l\src\wolfssl\utils.py -> build\lib.win-amd64-3.7\wolfssl
    copying C:\Users\909011\AppData\Local\Temp\pip-req-build-20hrf96l\src\wolfssl\_build_ffi.py -> build\lib.win-amd64-3.7\wolfssl
    copying C:\Users\909011\AppData\Local\Temp\pip-req-build-20hrf96l\src\wolfssl\_build_wolfssl.py -> build\lib.win-amd64-3.7\wolfssl
    copying C:\Users\909011\AppData\Local\Temp\pip-req-build-20hrf96l\src\wolfssl\_methods.py -> build\lib.win-amd64-3.7\wolfssl
    copying C:\Users\909011\AppData\Local\Temp\pip-req-build-20hrf96l\src\wolfssl\__about__.py -> build\lib.win-amd64-3.7\wolfssl
    copying C:\Users\909011\AppData\Local\Temp\pip-req-build-20hrf96l\src\wolfssl\__init__.py -> build\lib.win-amd64-3.7\wolfssl
    running build_ext
    generating cffi module 'build\\temp.win-amd64-3.7\\Release\\wolfssl._ffi.c'
    creating build\temp.win-amd64-3.7
    creating build\temp.win-amd64-3.7\Release
    '.' is not recognized as an internal or external command,
    operable program or batch file.
    'libtoolize' is not recognized as an internal or external command,
    operable program or batch file.
    Traceback (most recent call last):
      File "C:\Users\909011\AppData\Local\Temp\pip-req-build-20hrf96l\src\wolfssl\_build_wolfssl.py", line 171, in make
        call("./autogen.sh")
      File "C:\Users\909011\AppData\Local\Temp\pip-req-build-20hrf96l\src\wolfssl\_build_wolfssl.py", line 69, in call
        subprocess.check_call(cmd, shell=True, env=os.environ)
      File "c:\programs\python\python371\lib\subprocess.py", line 341, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command './autogen.sh' returned non-zero exit status 1.

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\909011\AppData\Local\Temp\pip-req-build-20hrf96l\setup.py", line 116, in <module>
        cmdclass={"build_ext" : cffiBuilder}
      File "c:\programs\python\python371\lib\site-packages\setuptools\__init__.py", line 153, in setup
        return distutils.core.setup(**attrs)
      File "c:\programs\python\python371\lib\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "c:\programs\python\python371\lib\distutils\dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "c:\programs\python\python371\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "c:\programs\python\python371\lib\site-packages\setuptools\command\install.py", line 61, in run
        return orig.install.run(self)
      File "c:\programs\python\python371\lib\distutils\command\install.py", line 545, in run
        self.run_command('build')
      File "c:\programs\python\python371\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "c:\programs\python\python371\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "c:\programs\python\python371\lib\distutils\command\build.py", line 135, in run
        self.run_command(cmd_name)
      File "c:\programs\python\python371\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "c:\programs\python\python371\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "c:\programs\python\python371\lib\site-packages\cffi\setuptools_ext.py", line 142, in run
        base_class.run(self)
      File "c:\programs\python\python371\lib\site-packages\setuptools\command\build_ext.py", line 79, in run
        _build_ext.run(self)
      File "c:\programs\python\python371\lib\distutils\command\build_ext.py", line 339, in run
        self.build_extensions()
      File "c:\programs\python\python371\lib\distutils\command\build_ext.py", line 448, in build_extensions
        self._build_extensions_serial()
      File "c:\programs\python\python371\lib\distutils\command\build_ext.py", line 473, in _build_extensions_serial
        self.build_extension(ext)
      File "C:\Users\909011\AppData\Local\Temp\pip-req-build-20hrf96l\setup.py", line 76, in build_extension
        build_wolfssl(wolfssl.__wolfssl_version__)
      File "C:\Users\909011\AppData\Local\Temp\pip-req-build-20hrf96l\src\wolfssl\_build_wolfssl.py", line 189, in build_wolfssl
        make(make_flags(prefix))
      File "C:\Users\909011\AppData\Local\Temp\pip-req-build-20hrf96l\src\wolfssl\_build_wolfssl.py", line 173, in make
        call("libtoolize")
      File "C:\Users\909011\AppData\Local\Temp\pip-req-build-20hrf96l\src\wolfssl\_build_wolfssl.py", line 69, in call
        subprocess.check_call(cmd, shell=True, env=os.environ)
      File "c:\programs\python\python371\lib\subprocess.py", line 341, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command 'libtoolize' returned non-zero exit status 1.
    Calling: 'git clean -fdX' from working directory C:\Users\909011\AppData\Local\Temp\pip-req-build-20hrf96l\lib\wolfssl\src
    Calling: './autogen.sh' from working directory C:\Users\909011\AppData\Local\Temp\pip-req-build-20hrf96l\lib\wolfssl\src
    Calling: 'libtoolize' from working directory C:\Users\909011\AppData\Local\Temp\pip-req-build-20hrf96l\lib\wolfssl\src
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\programs\python\python371\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\909011\\AppData\\Local\\Temp\\pip-req-build-20hrf96l\\setup.py'"'"'; __file__='"'"'C:\\Users\\909011\\AppData\\Local\\Temp\\pip-req-build-20hrf96l\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\909011\AppData\Local\Temp\pip-record-zm54dsme\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\programs\python\python371\Include\wolfssl' Check the logs for full command output.
WARNING: You are using pip version 20.3.1; however, version 21.0 is available.
You should consider upgrading via the 'c:\programs\python\python371\python.exe -m pip install --upgrade pip' command.

Share

Re: SSL connection is failing with error "No shared cipher"

What is your operating environment?

Re: SSL connection is failing with error "No shared cipher"

Windows 10, 64-bit processor.

Share

Re: SSL connection is failing with error "No shared cipher"

Are you using Cygwin?