|
[原创]注册码证书验证过程
mqk233 wangzhehyd 能贴个生成signatureBase64的过程么 signatureBase64就是用私钥去签base64加密之前的lic ... 搞定,多谢多谢。
最后于 2022-10-10 12:25
被wangzhehyd编辑
,原因:
|
|
|
|
[原创]注册码证书验证过程
mqk233 执行报错NameError: name 'serialization' is not defined 可以吧import贴出来吗,我用openssl生成的证书居然用不了,https://github ... from cryptography.hazmat.primitives.asymmetric import rsa from cryptography.hazmat.primitives import hashes, serialization from cryptography.hazmat.backends import default_backend from cryptography import x509 from cryptography.x509.oid import NameOID from datetime import datetime, timedelta |
|
[原创]注册码证书验证过程
mqk233 大佬有兴趣写个证书生成的教程嘛 大佬们不出现,我们交流交流,哈哈哈 with open('fake_ca_4096/fake_ca.pem', 'rb') as f: ca_private_key = serialization.load_pem_private_key(f.read(), password=None, backend=default_backend()) private_key = rsa.generate_private_key(public_exponent=65537, key_size=4096, backend=default_backend()) public_key = private_key.public_key() builder = x509.CertificateBuilder() builder = builder.subject_name(x509.Name([x509.NameAttribute(NameOID.COMMON_NAME, 'JetBrains'),])) builder = builder.issuer_name(x509.Name([x509.NameAttribute(NameOID.COMMON_NAME, 'JetProfile CA'),])) builder = builder.not_valid_before(datetime.today()) builder = builder.not_valid_after(datetime.today() + timedelta(days=18250)) builder = builder.serial_number(x509.random_serial_number()) builder = builder.public_key(public_key) builder = builder.add_extension(x509.BasicConstraints(ca=False, path_length=None), critical=False) builder = builder.add_extension(x509.SubjectKeyIdentifier.from_public_key(public_key), critical=False) with open('jetbrains_CA.crt', "rb") as f: crt = x509.load_pem_x509_certificate(f.read(), default_backend()) #print(crt.extensions) key_identifier = crt.extensions[1].value.key_identifier authority_cert_issuer = crt.extensions[1].value.authority_cert_issuer authority_cert_serial_number = crt.extensions[1].value.authority_cert_serial_number builder = builder.add_extension(x509.AuthorityKeyIdentifier(key_identifier, authority_cert_issuer, authority_cert_serial_number), critical=False) builder = builder.add_extension(x509.ExtendedKeyUsage([x509.oid.ExtendedKeyUsageOID.SERVER_AUTH]), critical=False) builder = builder.add_extension(x509.KeyUsage(digital_signature=True, key_encipherment=True, key_cert_sign=False, key_agreement=False, content_commitment=False, data_encipherment=False, crl_sign=False, encipher_only=False, decipher_only=False), critical=False) certificate = builder.sign(private_key=ca_private_key, algorithm=hashes.SHA256(), backend=default_backend()) private_bytes = private_key.private_bytes(encoding=serialization.Encoding.PEM, format=serialization.PrivateFormat.TraditionalOpenSSL, encryption_algorithm=serialization.NoEncryption()) public_bytes = certificate.public_bytes(encoding=serialization.Encoding.PEM) with open("fake_ca.pem", "wb") as fout: fout.write(private_bytes + public_bytes) with open("fake_ca.crt", "wb") as fout: fout.write(public_bytes) |
|
[原创]注册码证书验证过程
weizi 终于搞定了,原来是这个。 确实应该好好学x509。非常感谢guduzhe!!DirName:/CN=JetProfile CA serial:F8:CF:F3:36:EF:0A:18 ... 根据大家讨论搞了一天半没搞定,求指点。目前好像没人提注册码生成的步骤,下面是尝试生成注册码的代码。 #自建证书和密钥 crt = sys.argv[1] pem = sys.argv[2] with open('key', 'r') as f: key = f.read() licenseId, licensePartBase64, signatureBase64, certBase64 = key.split('-') with open(crt, 'rb') as f: lines = f.read() crt = x509.load_pem_x509_certificate(lines, default_backend()) newCertBase64 = ''.join(lines.decode("utf-8").split('\n')[1:-2]) #print(newCertBase64) # 自建证书的签名信息 sign = int.from_bytes(crt.signature, byteorder="big") #print(sign) # 自建证书sha256摘要结果 m = hashlib.sha256() m.update(crt.tbs_certificate_bytes) m.block_size k = m.hexdigest() print(k) with open(pem, 'rb') as f: private_key = serialization.load_pem_private_key(f.read(), password=None, backend=default_backend()) #print(private_key) with open('jetbrains_CA.pem', 'rb') as f: ca_public_key = serialization.load_pem_public_key(f.read(), backend=default_backend()) #print(licenseId, licensePartBase64, signatureBase64, certBase64) #print('licensePart: ', base64.b64decode(licensePartBase64)) newLicensePart = base64.b64decode(licensePartBase64).decode('utf-8').replace('2025-08-01','2050-12-31').encode('utf-8') newLicensePartBase64 = base64.b64encode(newLicensePart) #print(newLicensePartBase64) mgf = padding.MGF1(hashes.SHA256()) salt_length = padding.PSS.MAX_LENGTH sign = private_key.sign(newLicensePart, padding.PSS(mgf=mgf, salt_length=salt_length), hashes.SHA256()) #print(len(sign)) newSignatureBase64 = base64.b64encode(sign) #print(sign) #print(newSignatureBase64) #private_key.public_key().verify( crt.public_key().verify( sign, newLicensePart, padding.PSS(mgf=mgf, salt_length=salt_length), algorithm=hashes.SHA256(), ) newKey = f"{licenseId}-{newLicensePartBase64.decode('utf-8')}-{newSignatureBase64.decode('utf-8')}-{newCertBase64}" print(newKey)
最后于 2022-10-1 16:01
被wangzhehyd编辑
,原因:
|
|
|
|
[分享][下载]IDA Pro 7.5 Linux Demo
Patch program下面的Assemble的功能是灰色的,不知道能不能解除限制 |
|
[转帖] IDA 7.4.191112
Alfik IDA Pro 7.4 (incl. Hex-Rays x86, x64, ARM32, ARM64, PowerPC, PowerPC64) x64_idaprofw_hexarm64fw_hex ...没安装密码唉 |
|
python的库要有license才能调用,已找到IsLicensed判断
0000000003AF4F0 push r12 .text:00000000003AF4F2 push rbp .text:00000000003AF4F3 push rbx .text:00000000003AF4F4 mov rbx, rsi .text:00000000003AF4F7 sub rsp, 70h .text:00000000003AF4FB mov rax, [rsi+8] .text:00000000003AF4FF test byte ptr [rax+0ABh], 4 .text:00000000003AF506 jz loc_3AF6C0 .text:00000000003AF50C mov rdi, rsi .text:00000000003AF50F call _PyObject_Size .text:00000000003AF514 test eax, eax .text:00000000003AF516 jg short loc_3AF548 .text:00000000003AF518 test eax, eax .text:00000000003AF51A jnz short loc_3AF55D .text:00000000003AF51C lea rsi, aOechemislicens ; "OEChemIsLicensed" .text:00000000003AF523 xor ecx, ecx .text:00000000003AF525 xor edx, edx .text:00000000003AF527 mov rdi, rbx .text:00000000003AF52A call _PyArg_UnpackTuple .text:00000000003AF52F test eax, eax .text:00000000003AF531 jnz loc_3AF710 |
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值