- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我有一个python应用程序,它与python、Libcrypto和LibSSL共享对象打包在一起应用程序是用Openssl Fips模块2.0构建的Python的请求模块和urllib3使用这些共享对象来发出TLS请求。
我在构建应用程序的环境中启用了OPENSSL_FIPS标志现在,如果想检查当我将共享对象从开发环境中取出并放到另一台计算机中时,它们是否启用了fips模式,我该如何做?
如何检查fips模式是否已启用如果不是,如何为这些共享对象启用fips模式?
可能有帮助的其他详细信息:
OpenSSL版本:1.0.2H(从源代码构建)
FIPS模块:2.0.12(从源代码构建)
蟒蛇:3.6
操作系统:ubuntu 16.04 LTS
如果需要其他细节,请告诉我。
谢谢!
最佳答案
我已经使用常规标志构建了openssl fips模块(例如:no asm,shared,some olgent ciphers disabled):
[cfati@cfati-ubtu16x64-0:~/Work/Dev/StackOverflow/q049320993]> ls ssl/build/bin ssl/build/lib
ssl/build/bin:
c_rehash openssl
ssl/build/lib:
engines libcrypto.a libcrypto.so libcrypto.so.1.0.0 libssl.a libssl.so libssl.so.1.0.0 pkgconfig
[cfati@cfati-ubtu16x64-0:~/Work/Dev/StackOverflow/q049320993]> ssl/build/bin/openssl version
OpenSSL 1.0.2h-fips 3 May 2016 (Library: OpenSSL 1.0.2g 1 Mar 2016)
[cfati@cfati-ubtu16x64-0:~/Work/Dev/StackOverflow/q049320993]> LD_LIBRARY_PATH=ssl/build/lib ssl/build/bin/openssl version
OpenSSL 1.0.2h-fips 3 May 2016
[cfati@cfati-ubtu16x64-0:~/Work/Dev/StackOverflow/q049320993]> LD_LIBRARY_PATH=ssl/build/lib ssl/build/bin/openssl md5 ./code.py
MD5(./code.py)= d41d8cd98f00b204e9800998ecf8427e
[cfati@cfati-ubtu16x64-0:~/Work/Dev/StackOverflow/q049320993]> LD_LIBRARY_PATH=ssl/build/lib ssl/build/bin/openssl sha1 ./code.py
SHA1(./code.py)= da39a3ee5e6b4b0d3255bfef95601890afd80709
[cfati@cfati-ubtu16x64-0:~/Work/Dev/StackOverflow/q049320993]> OPENSSL_FIPS=1 LD_LIBRARY_PATH=ssl/build/lib ssl/build/bin/openssl sha1 ./code.py
SHA1(./code.py)= da39a3ee5e6b4b0d3255bfef95601890afd80709
[cfati@cfati-ubtu16x64-0:~/Work/Dev/StackOverflow/q049320993]> OPENSSL_FIPS=1 LD_LIBRARY_PATH=ssl/build/lib ssl/build/bin/openssl md5 ./code.py
Error setting digest md5
139778679649944:error:060A80A3:digital envelope routines:FIPS_DIGESTINIT:disabled for fips:fips_md.c:180:
#!/usr/bin/env python3
import sys
import ssl
import ctypes
libcrypto = ctypes.CDLL("libcrypto.so.1.0.0")
fips_mode = libcrypto.FIPS_mode
fips_mode.argtypes = []
fips_mode.restype = ctypes.c_int
fips_mode_set = libcrypto.FIPS_mode_set
fips_mode_set.argtypes = [ctypes.c_int]
fips_mode_set.restype = ctypes.c_int
text = b""
if __name__ == "__main__":
print("Python {:s} on {:s}\n".format(sys.version, sys.platform))
print("OPENSSL_VERSION: {:s}".format(ssl.OPENSSL_VERSION))
enable_fips = len(sys.argv) > 1
print("FIPS_mode(): {:d}".format(fips_mode()))
if enable_fips:
print("FIPS_mode_set(1): {:d}".format(fips_mode_set(1)))
print("FIPS_mode(): {:d}".format(fips_mode()))
import hashlib
print("SHA1: {:s}".format(hashlib.sha1(text).hexdigest()))
print("MD5: {:s}".format(hashlib.md5(text).hexdigest()))
import hashlib
语句位于设置fips模式之后(而不是在文件的开头,因为它应该在文件的开头),因为hashlib在导入时执行一些缓存,所以它在导入时捕获fips值,并且不关心它是否在之后更改。
[cfati@cfati-ubtu16x64-0:~/Work/Dev/StackOverflow/q049320993]> LD_LIBRARY_PATH=ssl/build/lib ./code.py
Python 3.5.2 (default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609] on linux
OPENSSL_VERSION: OpenSSL 1.0.2h-fips 3 May 2016
FIPS_mode(): 0
FIPS_mode(): 0
SHA1: da39a3ee5e6b4b0d3255bfef95601890afd80709
MD5: d41d8cd98f00b204e9800998ecf8427e
[cfati@cfati-ubtu16x64-0:~/Work/Dev/StackOverflow/q049320993]> LD_LIBRARY_PATH=ssl/build/lib ./code.py 1
Python 3.5.2 (default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609] on linux
OPENSSL_VERSION: OpenSSL 1.0.2h-fips 3 May 2016
FIPS_mode(): 0
FIPS_mode_set(1): 1
FIPS_mode(): 1
SHA1: da39a3ee5e6b4b0d3255bfef95601890afd80709
fips_md.c(149): OpenSSL internal error, assertion failed: Digest Final previous FIPS forbidden algorithm error ignored
Aborted (core dumped)
openssl version
测试w/wo ld_library_路径)。不支持fips的openssl仍将导出这两个函数,但它们都只返回0。
[cfati@cfati-ubtu16x64-0:~/Work/Dev/StackOverflow/q049320993]> ./code.py 1
Python 3.5.2 (default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609] on linux
OPENSSL_VERSION: OpenSSL 1.0.2g 1 Mar 2016
FIPS_mode(): 0
FIPS_mode_set(1): 0
FIPS_mode(): 0
SHA1: da39a3ee5e6b4b0d3255bfef95601890afd80709
MD5: d41d8cd98f00b204e9800998ecf8427e
关于python - 如何为Python打包的libcrypto和libssl启用FIPS模式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49320993/
我在使用 nuget 打包新包时遇到问题,因为当我通过命令行指定版本时,它会将它应用于包而不是依赖项。即 NuGet.exe pack myproject.csproj -Version 3.0.4.
考虑这个简短的例子: $a = pack("d",255); print length($a)."\n"; # Prints 8 $aa = pack("ddddd", 255,123,0,45,12
我有一个我想要的无符号整数数组(32 位) pack 成二进制流: my @n = (4,8,15,16,23,42); my $foo = join('', map(pack('I', $_), @
在我的工作中,我们必须在各种环境中部署应用程序。这是一个标准的 WAR 文件,需要一些配置,部署在 Tomcat 6 上。 有没有什么方法可以使用 Tomcat 创建一个“部署包”,以便您只需提取它并
我正在编写一个简单的数据包序列化程序,但我很难为我的数据包创建 header 。我正在创建一个缓冲区,然后尝试将前两项加载到缓冲区中。我运行 memcopy 但缓冲区中实际上没有任何内容,然后当我尝试
有人可以解释为什么当你有一个普通的小部件时,一行代码 A 可以工作 Entry(root, width=10).pack(side=LEFT,anchor=W) 但是当你给它命名或附加命令时,代码 A
我正在尝试使用this tutorial构建Python包。这是文件夹结构: testpackage\ testpackage\ __init__.py
我有 JFrame 和 GridBagLayout。用户可以调整此窗口的大小。此外,他还可以执行一些更改窗口大小的编辑操作。我使用 pack(); repaint(); 现在在这样的操作之后。但是,实
我有一个现实世界的问题,我认为需要某种优化,而不是对我关心的数据数组进行简单排序。我将在下面概述问题: 我有一个由不同设备组成的数据集,每个设备都有属性 A 和 B。A 和 B 彼此不依赖,但是,我想
按照目前的情况,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
我必须将旧的“加密”数据从旧系统转换为适当的加密算法。我有这段代码: function unpackString($s,$l){ $tmp=unpack('c'.$l,$s);
我有两个发电机。第一个生成器有时需要调用第二个生成器并返回它从那里获得的值: def a(): for _b in b(): yield _b def b(): yie
首先:对不起,我知道有很多关于相对导入的问题,但我只是没有找到解决方案。如果可能的话,我想使用以下目录布局: myClass/ __init__.py test/ de
1 ambari + bigtop 构建大数据基础平台 1.1 参考: 1.2 参考 amabri bigtop 打包部署
所以 SimpleInjector 现在有一个包装 nuget,您可以使用它来隔离根组合的不同方面。 假设我在一个库中有一个可配置的组合根,它被应用程序中的多个项目重用。例如,在 Azure 解决方案
我想以易于分发的形式打包 Groovy CLI 应用程序,类似于 Java 对 JAR 所做的。我一直无法找到任何似乎能够做到这一点的东西。我发现了一些类似 this 的东西用于一次性脚本,但不能编译
目前 ZMI 管理“打包数据库”的功能有点粗糙。 1) 是否有可能为 Web UI 提供某种进度指示器?例如。一个告诉你还剩多少分钟/小时,至少给出某种估计 2) ZODB 打包如何影响站点的响应性?
我有一个看起来像这样的结构: struct vdata { static_assert(sizeof(uint8_t *) == 8L, "size of pointer must be 8");
我已经尝试打包/发布我的 Azure 项目有一段时间了(但没有成功)。我尝试过以下方法: 右键单击 -> 从 Visual Studio 打包/发布 (OutOfMemoryException) CS
我创建了一个 JavaScript 库,并将其打包为以下选定的选项:Shrink Variables和Base62 Encoded在这个网址:http://dean.edwards.name/pack
我是一名优秀的程序员,十分优秀!