标签: openssl

Python AttributeError:'module'对象没有属性'SSL_ST_INIT'

我的Python脚本失败了:

Traceback (most recent call last):
  File "./inspect_sheet.py", line 21, in <module>
    main()
  File "./inspect_sheet.py", line 12, in main
    workbook_name=workbook_name,
  File "./google_sheets.py", line 56, in __init__
    self.login()
  File "./google_sheets.py", line 46, in login
    self.client = gspread.authorize(credentials)
  File "/usr/local/lib/python2.7/site-packages/gspread/client.py", line 335, in authorize
    client.login()
  File "/usr/local/lib/python2.7/site-packages/gspread/client.py", line 98, in login
    self.auth.refresh(http)
  File "/usr/local/lib/python2.7/site-packages/oauth2client/client.py", line 598, in refresh
    self._refresh(http.request)
  File "/usr/local/lib/python2.7/site-packages/oauth2client/client.py", line 769, in _refresh
    self._do_refresh_request(http_request)
  File "/usr/local/lib/python2.7/site-packages/oauth2client/client.py", line 795, in _do_refresh_request
    body = self._generate_refresh_request_body()
  File "/usr/local/lib/python2.7/site-packages/oauth2client/client.py", line 1425, in _generate_refresh_request_body
    assertion …
Run Code Online (Sandbox Code Playgroud)

python openssl pyopenssl

72
推荐指数
8
解决办法
7万
查看次数

SSL 错误不安全旧版重新协商已禁用

我正在运行一个 Python 代码,我必须从HTTPSConnectionPool(host='ssd.jpl.nasa.gov', port=443). 但每次我尝试运行代码时都会收到以下错误。我的系统是 MAC 操作系统 12.1

raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='ssd.jpl.nasa.gov', port=443): Max retries exceeded with url: /api/horizons.api?format=text&EPHEM_TYPE=OBSERVER&QUANTITIES_[...]_ (Caused by SSLError(SSLError(1, '[SSL: UNSAFE_LEGACY_RENEGOTIATION_DISABLED] unsafe legacy renegotiation disabled (_ssl.c:997)')))
Run Code Online (Sandbox Code Playgroud)

我真的不知道如何绕过这个问题。

python ssl openssl runtime-error

72
推荐指数
6
解决办法
17万
查看次数

OpenSSL:无法验证Experian URL的第一个证书

我正在尝试使用OpenSSL客户端验证在Ubuntu 10.10中与Experian的SSL连接.

openssl s_client -CApath /etc/ssl/certs/ -connect dm1.experian.com:443
Run Code Online (Sandbox Code Playgroud)

问题是连接以Verify返回代码关闭:21(无法验证第一个证书).

我检查了证书列表,用于签署Experian(VeriSign Class 3安全服务器CA-G3)的证书包含在列表中.

/etc/ssl/certs/ca-certificates.crt 
Run Code Online (Sandbox Code Playgroud)

但我不知道为什么它无法验证第一张证书.提前致谢.

整个响应可以在这里看到:https: //gist.github.com/1248790

ssl openssl certificate

71
推荐指数
3
解决办法
17万
查看次数

是否有可能使openssl跳过国家/通用名称提示?

有没有办法让openssl滑动提示,例如

Country Name (2 letter code) [US]:
Organization Name (eg, company) [My Company Name LTD.]:
Common Name (eg, YOUR name) [something]:
Run Code Online (Sandbox Code Playgroud)

使用时创建证书

openssl req -config openssl.cnf -new -x509 ...
Run Code Online (Sandbox Code Playgroud)

鉴于这些参数在openssl.cnf文件中提供

例如

countryName         = Country Name (2 letter code)
countryName_default     = US
countryName_min     = 2
countryName_max     = 2
0.organizationName      = Organization Name (eg, company)
0.organizationName_default  = My Company Name LTD.
commonName          = Common Name (eg, YOUR name)
commonName_max      = 64
commonName_default      = ${ENV::CN}
Run Code Online (Sandbox Code Playgroud)

openssl

71
推荐指数
5
解决办法
4万
查看次数

在openssl_encrypt中使用初始化向量

我看了一下这个问题,并希望自己做.当我运行此代码时(直接从这个答案):

$textToEncrypt = "My super secret information.";
$encryptionMethod = "AES-256-CBC";  // AES is used by the U.S. gov't to encrypt top secret documents.
$secretHash = "25c6c7ff35b9979b151f2136cd13b0ff";

//To encrypt
$encryptedMessage = openssl_encrypt($textToEncrypt, $encryptionMethod, $secretHash, '1234567812345678');

//To Decrypt
$decryptedMessage = openssl_decrypt($encryptedMessage, $encryptionMethod, $secretHash);

//Result
echo "Encrypted: $encryptedMessage <br>Decrypted: $decryptedMessage";
Run Code Online (Sandbox Code Playgroud)

但是我得到了警告

openssl_encrypt(): Using an empty Initialization Vector (iv) is potentially insecure and not recommended
Run Code Online (Sandbox Code Playgroud)

所以我去看看文档,但没有文档.我发现了这个评论,但仍然没有提到初始化矢量应该是什么以及我应该如何使用它.任何人都可以开导我吗?

我知道我本可以做更多的Google,但Stackoverflow首先出现在如此多的搜索结果中我认为这个问题对于遇到此问题的其他人可能会有用.

php security openssl

71
推荐指数
1
解决办法
5万
查看次数

如何使用公钥加密openssl中的大文件

如何使用公钥加密大文件,以便除了拥有私钥的人之外没有人能够解密它?

我可以制作RSA公钥和私钥,但是在使用此命令加密大文件时:

openssl rsautl -encrypt -pubin -inkey public.pem -in myLargeFile.xml -out myLargeFile_encrypted.xml
Run Code Online (Sandbox Code Playgroud)

我怎样才能执行解密....

我通过以下命令创建我的私钥和公钥

openssl genrsa -out private.pem 1024
openssl rsa -in private.pem -out public.pem -outform PEM -pubout
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

RSA operation error
3020:error:0406D06E:rsa routines:RSA_padding_add_PKCS1_type_2:data too large for key size:.\crypto\rsa\rsa_pk1.c:151:
Run Code Online (Sandbox Code Playgroud)

我试图制作大小从1024到1200位的密钥,没有运气,同样的错误

linux openssl

69
推荐指数
6
解决办法
10万
查看次数

从Windows上的bash脚本运行Openssl - 主题不以'/'开头

在我的剧本中我有:

openssl req \
  -x509 \
  -new \
  -nodes \
  -key certs/ca/my-root-ca.key.pem \
  -days 3652 \
  -out certs/ca/my-root-ca.crt.pem \
  -subj "/C=GB/ST=someplace/L=Provo/O=Achme/CN=${FQDN}"
Run Code Online (Sandbox Code Playgroud)

在Git Bash 3.1中在Windows上运行它给出:

Subject does not start with '/'.
Run Code Online (Sandbox Code Playgroud)

试图像这样逃避subj:-subj \"/ C = UK/ST = someplace/L = Provo/O = Achme/CN = $ {FQDN} \"

仍然无法正常工作.有任何想法吗?

windows string bash openssl

69
推荐指数
1
解决办法
2万
查看次数

使用OpenSSL以编程方式创建X509证书

我有一个C/C++应用程序,我需要创建一个包含公钥和私钥的X509 pem证书.证书可以是自签名的,也可以是未签名的,无关紧要.

我想在应用程序中执行此操作,而不是从命令行执行此操作.

什么OpenSSL功能会为我做这个?任何示例代码都是奖金!

openssl ssl-certificate x509 pkix

68
推荐指数
3
解决办法
5万
查看次数

如何使用OpenSSL编译.c文件包括?

我正在尝试编译一个包含以下内容的小型.c文件:

#include <openssl/ssl.h>
#include <openssl/rsa.h>
#include <openssl/x509.h>
#include <openssl/evp.h>
Run Code Online (Sandbox Code Playgroud)

在我拥有.c文件的同一个文件夹中,我有一个/ openssl包含所有这些文件(以及更多),同样在synaptic包管理器中我看到安装了OpenSSL,我试图用这个编译:

gcc -o Opentest Opentest.c -lcrypto
Run Code Online (Sandbox Code Playgroud)

但我总是得到错误:

error: openssl/ssl.h: No such file or directory
error: openssl/rsa.h: No such file or directory
error: openssl/x509.h: No such file or directory
error: openssl/evp.h: No such file or directory
Run Code Online (Sandbox Code Playgroud)

我想编译的文件只是一个.c文件,没有Makefile或./configure.

我已经尝试过:

env CFLAGS=-I/path/to/openssl/
Run Code Online (Sandbox Code Playgroud)

并尝试再次编译,但我得到相同的错误.

我应该怎么做才能用openssl编译包括?

c linux compiler-construction openssl compiler-errors

67
推荐指数
4
解决办法
16万
查看次数

身份验证失败,因为远程方已关闭传输流

我正在开发一个TCP客户端来连接OpenSSL服务器和证书身份验证.我使用服务器团队共享的.crt和.key文件.这些证书由OpenSSL命令生成.

我使用的SslStream对象调用来验证TCP客户端SslStream.AuthenticateAsClient通过将服务器的方法IP,SslProtocols.Ssl3X509CertificateCollection.

我收到以下错误:

身份验证失败,因为远程方已关闭传输流

.net openssl sslstream x509certificate

67
推荐指数
5
解决办法
8万
查看次数