-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathcert_ok.rb
144 lines (138 loc) · 6.71 KB
/
cert_ok.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
require 'base64'
require 'openssl'
require 'pp'
p "=========DeviceCertificate========="
s = %Q{
LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUNOakNDQVI2Z0F3SUJB
Z0lCQURBTkJna3Foa2lHOXcwQkFRVUZBREFBTUI0WERURXhNRFV3TlRFeE16
WXcKTjFvWERUSXhNRFV3TWpFeE16WXdOMW93QURDQm56QU5CZ2txaGtpRzl3
MEJBUUVGQUFPQmpRQXdnWWtDZ1lFQQpsb1NXUjAwQmdySkxxcWJtQ3pDcHE3
UEIxdjVXa3lMRHpEd1Uzdkl1VDBQVmRHMXhWS3kyUTBvblUxV25sa3pQCkI0
dWRaNFkvVVM4djhYTGk2aW5JTWFETGxES0tkWXU5ckcrZW1jMDZha2RPYUxp
VWpnL3J5Y0NvOGdRSWFzZUgKS2VZVS9kamVQZU4zZyt5RjNrU2NVSk92SW9N
cEVNWU5tenpOTm1aUHFmOENBd0VBQWFNL01EMHdEQVlEVlIwVApBUUgvQkFJ
d0FEQWRCZ05WSFE0RUZnUVVMVlBva2wzSS9rS0c1WWN5WVVmcGxsbXVOaWN3
RGdZRFZSMFBBUUgvCkJBUURBZ1dnTUEwR0NTcUdTSWIzRFFFQkJRVUFBNElC
QVFCZEFDejVsMGYxaXRMeURUZzF5UXA3K3cxdnB5anUKNmJ4Vm45QUNieHhP
VlVEK0pEQWVwV3lHaTNWZFBuWTR4aVhUZGhXVDJaMlExNTN0UGd3bEluL3ZP
NDRJKzBlQgo0bTYrUW1UOXd0cWtaN2d4U3BjSGp6TzRvSTkwcDZQVWRsZTdQ
OXlJZnhRZ2FTYnUxSXE5QnkwemVwcmUzbjlnCkQrdWU3S2srZGNWQzY2eVBH
emV5V21YRnN1UG9tL3lweWJlTW4zK1J6cWRWNVNTUEkvQytnb2lIRzlKeGxT
WmcKZnZPNlNjMnpvR2FJZFhjVVpoU3QySWFtekpRN0pSU2ZwVzRQM1p2SDZD
KzhOUk9KcjV5cGdqVFI1MEpnaXpHMApuKzJyT3IwNUpad1VqQUJZeTgzeVBC
M2tiL2NMQXgzaDFDL0t5WjhSbzR6ejN0eVBSL2hZdE5teAotLS0tLUVORCBD
RVJUSUZJQ0FURS0tLS0tCg==
}
tmp = Base64.decode64(s)
p tmp
device_cert = OpenSSL::X509::Certificate.new(tmp)
pp device_cert, device_cert.extensions, device_cert.public_key
key = OpenSSL::PKey::RSA.new(device_cert.public_key)
p "modulus:#{key.n}, exponent:#{key.e}"
p "=========DevicePublicKey========="
s = %Q{
LS0tLS1CRUdJTiBSU0EgUFVCTElDIEtFWS0tLS0tCk1JR0pBb0dCQUphRWxr
ZE5BWUt5UzZxbTVnc3dxYXV6d2RiK1ZwTWl3OHc4Rk43eUxrOUQxWFJ0Y1ZT
c3RrTksKSjFOVnA1Wk16d2VMbldlR1AxRXZML0Z5NHVvcHlER2d5NVF5aW5X
THZheHZucG5OT21wSFRtaTRsSTRQNjhuQQpxUElFQ0dySGh5bm1GUDNZM2oz
amQ0UHNoZDVFbkZDVHJ5S0RLUkRHRFpzOHpUWm1UNm4vQWdNQkFBRT0KLS0t
LS1FTkQgUlNBIFBVQkxJQyBLRVktLS0tLQo=
}
tmp = Base64.decode64(s)
p tmp
key = OpenSSL::PKey::RSA.new(tmp)
p "modulus:#{key.n}, exponent:#{key.e}"
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Tzda
UzJTVlVJRStpaFlESzRPYnIrUmg0S0FUeHMxWXhGakQwdlZhWjZQdkkwCjl6
eGRCSlFZRGV0NnBqcDhKZkNvcHhDSFg0cmxlcjBHOEhXNFF1clBsdzRRTDNC
cjdScng1L2h2aDlrZmZTUlYKMTA4RHBkbzdqR1RsL3MvWFhWb1hBY0k2VWZy
SDZOVEp2YjJVcVpPcFNVV3BuR21CcGRFM3NwRXdvczFuVTVDMQo0bThsbE1k
VEg4dzJFSFRyNEpaTlBybEhGKzdLOXRxdlFUdzZrSFVVCi0tLS0tRU5EIENF
UlRJRklDQVRFLS0tLS0K
}
tmp = Base64.decode64(s)
p tmp
device_cert = OpenSSL::X509::Certificate.new(tmp)
pp device_cert, device_cert.extensions, device_cert.public_key
key = OpenSSL::PKey::RSA.new(device_cert.public_key)
p "modulus:#{key.n}, exponent:#{key.e}"
p "=========RootCertificate========="
s = %Q{
LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUNyVENDQVpXZ0F3SUJB
Z0lCQURBTkJna3Foa2lHOXcwQkFRVUZBREFBTUI0WERURXhNRFV3TlRFeE16
WXcKTjFvWERUSXhNRFV3TWpFeE16WXdOMW93QURDQ0FTSXdEUVlKS29aSWh2
Y05BUUVCQlFBRGdnRVBBRENDQVFvQwpnZ0VCQU9CWUlQQ1lscVpQK0gzRHhy
RjRLYk1rOGNFWHlRMGxNSmRUNXB6MktTUkJkYjlsOTlHQWJhU1FJUVFvClBK
bnAvQ0xtZU5VeTV2aUdjTGM2ZTBrd0h0VWpqZENjUjl3Zk5qZ0E4ZXNiUFFI
WUFVN0pBczdXeWtQZyszMjUKVFV5VGNDQzJGclZqN3VYVERROC9selhQRHFi
eTRoMXNORWQrNUE3TE12N0tmUjh2UWFHNE5JcUozaXJnajI2SQpSY1hJeG1u
M2VNWXpqNkVLUFp4bmRrRW0vUVNiZjcwNFhVZmpyT1hUOEFKSTFZdkpocW9W
M2Q3NDE5dDFOZTQ5CmVYK2VKRnBPRXorQXhKQThaWFEzY20rYi9rcURkRkxW
dGppUllaRmJWYmQ5NU85WUQzelNUNUV1NU1CY2pEdjgKRnlXdkdJS0hxdDZi
ZnBNOGZ0ZDFBR2RydlBzQ0F3RUFBYU15TURBd0R3WURWUjBUQVFIL0JBVXdB
d0VCL3pBZApCZ05WSFE0RUZnUVUxdEdzcmNGdUlZbHNsNCtKN0daUWtaMWtv
N1F3RFFZSktvWklodmNOQVFFRkJRQURnZ0VCCkFFSVVwYUltRHp1bmlVbWRL
SDJXNEJBMFBuNi9PMUxGUjMzVjVZWXpsR0FQWUZveFdXbnRxTjZJZ2pwR0JW
emUKUjZWTnJTWDZlZFl4SGhWdFFXdm5qZ3ROeHNubnpXYi9UMGFYV1d3Q0R0
R1g5eUdzbW1HcmFCYXp4MVl1NmVISAo2MjhTYVJ2SGh3dkdqbzFlTHIrNFFH
eEsvdjlTaWcyRHdmN0FSUzFxWWdqQUVNQVdIbTlGeVJWeTdLZjVXZmdoCnFk
WVhueTl5N2xzcTdHcTYzWXE1SVVrVW5naGtWdm0wNmtZTmlNdDdpNWlvWk5U
NjhlRkZQalRBWHFjM2dXRmkKdmlWY2ZNMlBhaVB5MFNoZ1JVRlBJK1BWb1R4
Q2IwRnRYZ2o4TEx4M051N2hJSkE4WStZdGQzSVpocEYxL2hHMgpuNys5ZnNB
L09uclVLMitDVGVJVFZhWT0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=
}
tmp = Base64.decode64(s)
p tmp
device_cert = OpenSSL::X509::Certificate.new(tmp)
pp device_cert, device_cert.extensions, device_cert.public_key
key = OpenSSL::PKey::RSA.new(device_cert.public_key)
p "modulus:#{key.n}, exponent:#{key.e}"
p "=========EscrowBag========="
s = %Q{
REFUQQAABFRWRVJTAAAABAAAAAJUWVBFAAAABAAAAAJVVUlEAAAAELzHKKs3
RU1rsbYU4MTUMCpITUNLAAAAKMue81piI8UgnHtislleZRnKf0cF0jbCmJXI
rj1IPUD4Jl6OAGAk1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