我有两张桌子:
表格1:
id(int) | stuff(text)
-------------------------
1 | foobarfoobarfoo
2 | blahfooblah
3 | foo
Run Code Online (Sandbox Code Playgroud)
表2:
id(int) | otherstuff(text)
--------------------------
1 | foo
2 | bar
3 | blah
Run Code Online (Sandbox Code Playgroud)
table1中的一行可以有多个foo,bar等.而且,table2中的每一行都可以出现在table1的多行中.
这是保持这种直线的更好方法.我应该创建这样的第三个表:
表3:
id_from2(int) | id_from1(int)
-----------------------------
1 | 1
1 | 2
1 | 3
2 | 1
3 | 2
Run Code Online (Sandbox Code Playgroud)
或者,我应该在table1和table2中添加一个类型数组列来跟踪相同的信息吗?
当尝试使用从 PE 文件中提取证书时cryptography,失败并显示ValueError: Unable to load certificate. 我可以使用命令行从同一个 PE 文件中正确提取subprocess证书openssl。我想了解使用的代码版本出了什么问题cryptography。
我使用的是Python 3.7.1、加密2.4.2和pefile 2018.8.8
import pefile
from cryptography import x509
from cryptography.hazmat.backends import default_backend
pe = pefile.PE(fname)
pe.parse_data_directories(directories=[pefile.DIRECTORY_ENTRY['IMAGE_DIRECTORY_ENTRY_SECURITY']])
sigoff = 0
siglen = 0
for s in pe.__structures__:
if s.name == 'IMAGE_DIRECTORY_ENTRY_SECURITY':
sigoff = s.VirtualAddress
siglen = s.Size
pe.close()
with open(fname, 'rb') as fh:
fh.seek(sigoff)
thesig = fh.read(siglen)
cert = x509.load_der_x509_certificate(thesig[8:], default_backend())
Run Code Online (Sandbox Code Playgroud)
这失败了ValueError: Unable to load certificate
python openssl pyopenssl portable-executable python-cryptography