首页
社区
课程
招聘
[原创]注册码证书验证过程
发表于: 2022-1-5 22:49 45445

[原创]注册码证书验证过程

2022-1-5 22:49
45445
收藏
免费 1
支持
分享
最新回复 (41)
雪    币: 22
活跃值: (868)
能力值: ( LV5,RANK:60 )
在线值:
发帖
回帖
粉丝
26

我生成了一个,你那比较下看看吧。我这个也不知你那有啥问题。


注册码:

 T6TKM469T2-eyJsaWNlbnNlSWQiOiJUNlRLTTQ2OVQyIiwibGljZW5zZWVOYW1lIjoiaGVsbG8iLCJhc3NpZ25lZU5hbWUiOiIiLCJhc3NpZ25lZUVtYWlsIjoiIiwibGljZW5zZVJlc3RyaWN0aW9uIjoiIiwiY2hlY2tDb25jdXJyZW50VXNlIjpmYWxzZSwicHJvZHVjdHMiOlt7ImNvZGUiOiJQQyIsImZhbGxiYWNrRGF0ZSI6IjIwOTktMTItMzEiLCJwYWlkVXBUbyI6IjIwOTktMTItMzEiLCJleHRlbmRlZCI6ZmFsc2V9LHsiY29kZSI6IlBQQyIsImZhbGxiYWNrRGF0ZSI6IjIwOTktMTItMzEiLCJwYWlkVXBUbyI6IjIwOTktMTItMzEiLCJleHRlbmRlZCI6dHJ1ZX0seyJjb2RlIjoiUFdTIiwiZmFsbGJhY2tEYXRlIjoiMjA5OS0xMi0zMSIsInBhaWRVcFRvIjoiMjA5OS0xMi0zMSIsImV4dGVuZGVkIjp0cnVlfSx7ImNvZGUiOiJQU0kiLCJmYWxsYmFja0RhdGUiOiIyMDk5LTEyLTMxIiwicGFpZFVwVG8iOiIyMDk5LTEyLTMxIiwiZXh0ZW5kZWQiOnRydWV9LHsiY29kZSI6IlBDV01QIiwiZmFsbGJhY2tEYXRlIjoiMjA5OS0xMi0zMSIsInBhaWRVcFRvIjoiMjA5OS0xMi0zMSIsImV4dGVuZGVkIjp0cnVlfV0sIm1ldGFkYXRhIjoiMDEyMDIxMTIzMVBTQU4wMDAwMDUiLCJoYXNoIjoiVFJJQUw6LTIwNTY4NDUyNzMiLCJncmFjZVBl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o4GcMIGZMAkGA1UdEwQCMAAwHQYDVR0OBBYEFGHlynmN3e8YGjWrxsFgN+2NbszAMEgGA1UdIwRBMD+AFKOetkhnQhI2Qb1t4Lm0oFKLl/GzoRykGjAYMRYwFAYDVQQDDA1KZXRQcm9maWxlIENBggkA0myxg7KDeeEwEwYDVR0lBAwwCgYIKwYBBQUHAwEwDgYDVR0PAQH/BAQDAgWgMA0GCSqGSIb3DQEBCwUAA4ICAQBzZVjDm3olIL59Hy12EsK8hDsa+of+BfZzvRspm97g7btDdBoixbNYLQUGeoCTnP1ge/7HFyeLBLpJasSD0vN+v4cZN9mgU/pmAvFe7bpKxjaHVMApRuTKtSERNpEDrYeryfT9idCVAgT3IiT6+c4fe4KeTGw9RYPjwyt2SHOAyHe+zy4ZlJTmtZGzwjKHurMfKsbf1Kriu/PlSZLOFzuQt6C45U6811wuAT7rEwRntOeUPbcHWZfMbvLGymhuSLYU2Tav974/H26O/egVAkzms1fiqE0NRRNj1H/DbnoDtaC8lODdc0cXoItgNZd+e23eNhJ+ct5L06DNeDxIKlBqju7cs8ZsCzVMs0q5mcLtk8mWL62d8OSK8IcCmBF/m6fWhSbBUlogB/lnmd0TP/fanJXmCP62NcZwEB6aaGsrcrOZY4S860qDn83KtYeX+IAq2RIiLHBaRET15T6WKTttcPFFlgU5tR4xCrXbUnVFjw5vAhvufzMDZ3VERBu1nWl7IPy6aJPBA9Rw2Xn8DA9vIoJFFbJKPzfm9YUaA0/HwyRsuZo25hikCcJd8jd82QhZpeRiAkU7DY86ASHHb1OjEg0oecu1z1UF6ePfk84ylmlTlWxlVj/Yx6SfBlx+WNaH0CWkJp+kZ0XpzwdyzFLUgnPd2HGjG9K34dUJIQFvuA==



power插件的x,y,z信息

 470774140498715542279847511626751752509015869262164892587834213057257737728952819129156186192382952621704132104001064247693043393345838310294886258663418905789741338327853328625842687792058128753175220229850256045948898235090458476468020029318474705174957950738716869443037770812241170405539776333809037272290920791153466265555952334418874389115123460059909751597837705664240855895862520962641957065160103504902326600716904520514549163413432574403218806734551052227050875423627913770407593778952405850753996711007573889405695648857816013628520448885368457008033857448918123715627614994457670024321778120134731519284731510665547770096213220044492260583572376341852368726897805025622618741929317251614362472254937884472259278587296750033020644501764104477446544958490108415914767686862955573460650117746367769988766228549825125491047667807509824846332167169573539316948387132068548614439070410504700791927666541446473762717625890983554260380622575860803331179717929546229121057129583970657111614531038816617268482395610352643093555358794952298011133873904450130213239759725007718390180890058985819345403903200957426645265267416982295801847999878151482477916060736528608387310673462761316083902603146004894619745061556740623411162738616,65537,860106576952879101192782278876319243486072481962999610484027161162448933268423045647258145695082284265933019120714643752088997312766689988016808929265129401027490891810902278465065056686129972085119605237470899952751915070244375173428976413406363879128531449407795115913715863867259163957682164040613505040314747660800424242248055421184038777878268502955477482203711835548014501087778959157112423823275878824729132393281517778742463067583320091009916141454657614089600126948087954465055321987012989937065785013284988096504657892738536613208311013047138019418152103262155848541574327484510025594166239784429845180875774012229784878903603491426732347994359380330103328705981064044872334790365894924494923595382470094461546336020961505275530597716457288511366082299255537762891238136381924520749228412559219346777184174219999640906007205260040707839706131662149325151230558316068068139406816080119906833578907759960298749494098180107991752250725928647349597506532778539709852254478061194098069801549845163358315116260915270480057699929968468068015735162890213859113563672040630687357054902747438421559817252127187138838514773245413540030800888215961904267348727206110582505606182944023582459006406137831940959195566364811905585377246353->31872219281407242025505148642475109331663948030010491344733687844358944945421064967310388547820970408352359213697487269225694990179009814674781374751323403257628081559561462351695605167675284372388551941279783515209238245831229026662363729380633136520288327292047232179909791526492877475417113579821717193807584807644097527647305469671333646868883650312280989663788656507661713409911267085806708237966730821529702498972114194166091819277582149433578383639532136271637219758962252614390071122773223025154710411681628917523557526099053858210363406122853294409830276270946292893988830514538950951686480580886602618927728470029090747400687617046511462665469446846624685614084264191213318074804549715573780408305977947238915527798680393538207482620648181504876534152430149355791756374642327623133843473947861771150672096834149014464956451480803326284417202116346454345929350148770746553056995922154382822307758515805142704373984019252210715650875853634697920708113806880196144197384637328982263167395073688501517286678083973976140696077590122053014085412828620051470085033364773099146103525313018873319293728800442101520384088109603555959893639842091339193833443615412662812237280172041858180801277266868357666225569529434411578961382


2022-2-14 16:39
0
雪    币: 0
活跃值: (49)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
27
weizi 我生成了一个,你那比较下看看吧。我这个也不知你那有啥问题。注册码: T6TKM469T2-eyJsaWNlbnNlSWQiOiJUNlRLTTQ2OVQyIiwibGljZW5zZW ...
找到问题了,是要设置ctricial,谢谢
2022-2-14 18:07
0
雪    币: 21
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
28
受益匪浅,key生成器搞定了
2022-6-15 09:58
0
雪    币: 2
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
29


写了一个注册机,欢迎品尝



最后于 2022-9-28 14:56 被angelkyo028编辑 ,原因:
上传的附件:
2022-9-28 12:58
0
雪    币: 274
活跃值: (388)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
30
weizi 哦,用4096根证书去签
咋用4096根证书去签,就知道public_key
2022-10-1 14:12
0
雪    币: 274
活跃值: (388)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
31
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编辑 ,原因:
2022-10-1 14:19
0
雪    币: 20
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
32
大佬,请问字符串3031300D060960864801650304020105000420的来源是哪里啊,还有padding方法有什么说法嘛
2022-10-5 11:15
0
雪    币: 20
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
33
weizi 终于搞定了,原来是这个。 确实应该好好学x509。非常感谢guduzhe!!DirName:/CN=JetProfile CA serial:F8:CF:F3:36:EF:0A:18 ...
大佬有兴趣写个证书生成的教程嘛
2022-10-5 17:10
0
雪    币: 274
活跃值: (388)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
34
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)


2022-10-7 20:59
0
雪    币: 20
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
35
wangzhehyd 大佬们不出现,我们交流交流,哈哈哈with open('fake_ca_4096/fake_ca.pem', 'rb ...
执行报错NameError: name 'serialization' is not defined
可以吧import贴出来吗,我用openssl生成的证书居然用不了,https://github.com/Nasller/LicenseServer 这个项目的证书配合jb的根证书竟然可以使用,好奇怪啊
2022-10-7 22:42
0
雪    币: 20
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
36
openlinux 找到问题了,是要设置ctricial,谢谢
我也是没设置这个就不行,但是官方的证书也没有设置,奇怪了
2022-10-8 13:08
0
雪    币: 274
活跃值: (388)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
37
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


2022-10-8 20:02
0
雪    币: 274
活跃值: (388)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
38
mqk233 我也是没设置这个就不行,但是官方的证书也没有设置,奇怪了
能贴个生成signatureBase64的过程么
2022-10-8 20:04
0
雪    币: 20
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
39
wangzhehyd 能贴个生成signatureBase64的过程么

signatureBase64就是用私钥去签base64加密之前的licensePartBase64就行了,

private static String generateActivationCode() {
        try {
            LicenseData licenseData =
                    new LicenseData("F5TRIB85C7", "maoxikun", "0120220715LPAA006008", "33275345/16983092:1750569653");
            byte[] licenseBytes = licenseData.toString().getBytes(StandardCharsets.UTF_8);
            Signature signature = Signature.getInstance("SHA1withRSA");
            PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(Base64.getDecoder().decode(Configs.PRIVATE_KEY));
            signature.initSign(KeyFactory.getInstance("RSA").generatePrivate(keySpec));
            signature.update(licenseBytes);
            return String.format("%s-%s-%s-%s",
                    licenseData.getLicenseId(),
                    Base64.getEncoder().encodeToString(licenseBytes),
                    Base64.getEncoder().encodeToString(signature.sign()),
                    Configs.PUBLIC_KEY);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }


最后于 2022-10-8 23:44 被mqk233编辑 ,原因:
2022-10-8 23:43
0
雪    币: 274
活跃值: (388)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
40
mqk233 wangzhehyd 能贴个生成signatureBase64的过程么 signatureBase64就是用私钥去签base64加密之前的lic ...

搞定,多谢多谢。

最后于 2022-10-10 12:25 被wangzhehyd编辑 ,原因:
2022-10-9 20:33
0
雪    币: 20
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
41
wangzhehyd  new LicenseData("F5TRIB85C7", "maoxikun&q ...

{

"licenseId": "F5TRIB85C7",

"licenseeName": "Shandong University",

"assigneeName": "ao li",

"assigneeEmail": "2867816268@qq.com",

"licenseRestriction": "For educational use only",

"checkConcurrentUse": false,

"products": [

{

"code": "DPN",

"paidUpTo": "2023-04-18",

"extended": false

},

{

"code": "DB",

"paidUpTo": "2023-04-18",

"extended": false

},

{

"code": "PS",

"paidUpTo": "2023-04-18",

"extended": false

},

{

"code": "II",

"paidUpTo": "2023-04-18",

"extended": false

},

{

"code": "RSC",

"paidUpTo": "2023-04-18",

"extended": true

},

{

"code": "GO",

"paidUpTo": "2023-04-18",

"extended": false

},

{

"code": "DM",

"paidUpTo": "2023-04-18",

"extended": false

},

{

"code": "RSF",

"paidUpTo": "2023-04-18",

"extended": true

},

{

"code": "DS",

"paidUpTo": "2023-04-18",

"extended": false

},

{

"code": "PC",

"paidUpTo": "2023-04-18",

"extended": false

},

{

"code": "RC",

"paidUpTo": "2023-04-18",

"extended": false

},

{

"code": "CL",

"paidUpTo": "2023-04-18",

"extended": false

},

{

"code": "WS",

"paidUpTo": "2023-04-18",

"extended": false

},

{

"code": "RD",

"paidUpTo": "2023-04-18",

"extended": false

},

{

"code": "RS0",

"paidUpTo": "2023-04-18",

"extended": false

},

{

"code": "RM",

"paidUpTo": "2023-04-18",

"extended": false

},

{

"code": "AC",

"paidUpTo": "2023-04-18",

"extended": false

},

{

"code": "RSV",

"paidUpTo": "2023-04-18",

"extended": true

},

{

"code": "DC",

"paidUpTo": "2023-04-18",

"extended": false

},

{

"code": "RSU",

"paidUpTo": "2023-04-18",

"extended": false

},

{

"code": "DP",

"paidUpTo": "2023-04-18",

"extended": true

},

{

"code": "PDB",

"paidUpTo": "2023-04-18",

"extended": true

},

{

"code": "PWS",

"paidUpTo": "2023-04-18",

"extended": true

},

{

"code": "PSI",

"paidUpTo": "2023-04-18",

"extended": true

},

{

"code": "PPS",

"paidUpTo": "2023-04-18",

"extended": true

},

{

"code": "PCWMP",

"paidUpTo": "2023-04-18",

"extended": true

},

{

"code": "PGO",

"paidUpTo": "2023-04-18",

"extended": true

},

{

"code": "PPC",

"paidUpTo": "2023-04-18",

"extended": true

},

{

"code": "PRB",

"paidUpTo": "2023-04-18",

"extended": true

},

{

"code": "PSW",

"paidUpTo": "2023-04-18",

"extended": true

},

{

"code": "RS",

"paidUpTo": "2023-04-18",

"extended": true

}

],

"metadata": "0120220715LPAA006008",

"hash": "33275345/16983092:1750569653",

"gracePeriodDays": 7,

"autoProlongated": false,

"isAutoProlongated": false

}


2022-10-10 10:42
0
雪    币: 180
活跃值: (21)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
42
学习了,谢谢!
2022-11-22 18:33
0
游客
登录 | 注册 方可回帖
返回
//