const 发布的文章

“const”

安裝 Mosquitto MQTT Broke

sudo apt install -y mosquitto mosquitto-clients

TEST Mosquitto MQTT Broker
建立 Subscriber

mosquitto_sub -h test.mosquitto.org -t Sensor/Temperature/Room1

建立 Publisher

mosquitto_pub -h 54.159.81.55 -t Sensor/Temperature/Room1 -m "hello world"

安裝paho-mqtt套件

pip install paho-mqtt

mosquitto_mqtt.py

import paho.mqtt.client as mqtt  
import time  
import json  
import random

# *********************************************************************
# MQTT Config

dataChnId1 = "Temperature"  
MQTT_SERVER = "test.mosquitto.org"  
MQTT_PORT = 1883  
MQTT_ALIVE = 60  
MQTT_TOPIC1 = "Sensor/" + dataChnId1 + "/Room1" 

# *********************************************************************

mqtt_client = mqtt.Client()  
mqtt_client.connect(MQTT_SERVER, MQTT_PORT, MQTT_ALIVE)    

while True:  
  t0 = random.randint(0,30)
  payload = {"dataChnId":dataChnId1,"value":t0}
  print(dataChnId1 + " : " + str(t0))
  mqtt_client.publish(MQTT_TOPIC1, json.dumps(payload), qos=1)
  time.sleep(10)

openssl 列出所有曲线

openssl ecparam -list_curves

secp112r1 : SECG/WTLS curve over a 112 bit prime field
secp112r2 : SECG curve over a 112 bit prime field
secp128r1 : SECG curve over a 128 bit prime field
secp128r2 : SECG curve over a 128 bit prime field
secp160k1 : SECG curve over a 160 bit prime field
secp160r1 : SECG curve over a 160 bit prime field
secp160r2 : SECG/WTLS curve over a 160 bit prime field
secp192k1 : SECG curve over a 192 bit prime field
secp224k1 : SECG curve over a 224 bit prime field
secp224r1 : NIST/SECG curve over a 224 bit prime field
secp256k1 : SECG curve over a 256 bit prime field
secp384r1 : NIST/SECG curve over a 384 bit prime field
secp521r1 : NIST/SECG curve over a 521 bit prime field
prime192v1: NIST/X9.62/SECG curve over a 192 bit prime field
prime192v2: X9.62 curve over a 192 bit prime field
prime192v3: X9.62 curve over a 192 bit prime field
prime239v1: X9.62 curve over a 239 bit prime field
prime239v2: X9.62 curve over a 239 bit prime field
prime239v3: X9.62 curve over a 239 bit prime field
prime256v1: X9.62/SECG curve over a 256 bit prime field
sect113r1 : SECG curve over a 113 bit binary field
sect113r2 : SECG curve over a 113 bit binary field
sect131r1 : SECG/WTLS curve over a 131 bit binary field
sect131r2 : SECG curve over a 131 bit binary field
sect163k1 : NIST/SECG/WTLS curve over a 163 bit binary field
sect163r1 : SECG curve over a 163 bit binary field
sect163r2 : NIST/SECG curve over a 163 bit binary field
sect193r1 : SECG curve over a 193 bit binary field
sect193r2 : SECG curve over a 193 bit binary field
sect233k1 : NIST/SECG/WTLS curve over a 233 bit binary field
sect233r1 : NIST/SECG/WTLS curve over a 233 bit binary field
sect239k1 : SECG curve over a 239 bit binary field
sect283k1 : NIST/SECG curve over a 283 bit binary field
sect283r1 : NIST/SECG curve over a 283 bit binary field
sect409k1 : NIST/SECG curve over a 409 bit binary field
sect409r1 : NIST/SECG curve over a 409 bit binary field
sect571k1 : NIST/SECG curve over a 571 bit binary field
sect571r1 : NIST/SECG curve over a 571 bit binary field
c2pnb163v1: X9.62 curve over a 163 bit binary field
c2pnb163v2: X9.62 curve over a 163 bit binary field
c2pnb163v3: X9.62 curve over a 163 bit binary field
c2pnb176v1: X9.62 curve over a 176 bit binary field
c2tnb191v1: X9.62 curve over a 191 bit binary field
c2tnb191v2: X9.62 curve over a 191 bit binary field
c2tnb191v3: X9.62 curve over a 191 bit binary field
c2pnb208w1: X9.62 curve over a 208 bit binary field
c2tnb239v1: X9.62 curve over a 239 bit binary field
c2tnb239v2: X9.62 curve over a 239 bit binary field
c2tnb239v3: X9.62 curve over a 239 bit binary field
c2pnb272w1: X9.62 curve over a 272 bit binary field
c2pnb304w1: X9.62 curve over a 304 bit binary field
c2tnb359v1: X9.62 curve over a 359 bit binary field
c2pnb368w1: X9.62 curve over a 368 bit binary field
c2tnb431r1: X9.62 curve over a 431 bit binary field
wap-wsg-idm-ecid-wtls1: WTLS curve over a 113 bit binary field
wap-wsg-idm-ecid-wtls3: NIST/SECG/WTLS curve over a 163 bit binary field
wap-wsg-idm-ecid-wtls4: SECG curve over a 113 bit binary field
wap-wsg-idm-ecid-wtls5: X9.62 curve over a 163 bit binary field
wap-wsg-idm-ecid-wtls6: SECG/WTLS curve over a 112 bit prime field
wap-wsg-idm-ecid-wtls7: SECG/WTLS curve over a 160 bit prime field
wap-wsg-idm-ecid-wtls8: WTLS curve over a 112 bit prime field
wap-wsg-idm-ecid-wtls9: WTLS curve over a 160 bit prime field
wap-wsg-idm-ecid-wtls10: NIST/SECG/WTLS curve over a 233 bit binary field
wap-wsg-idm-ecid-wtls11: NIST/SECG/WTLS curve over a 233 bit binary field
wap-wsg-idm-ecid-wtls12: WTLS curve over a 224 bit prime field
Oakley-EC2N-3:
Oakley-EC2N-4:
brainpoolP160r1: RFC 5639 curve over a 160 bit prime field
brainpoolP160t1: RFC 5639 curve over a 160 bit prime field
brainpoolP192r1: RFC 5639 curve over a 192 bit prime field
brainpoolP192t1: RFC 5639 curve over a 192 bit prime field
brainpoolP224r1: RFC 5639 curve over a 224 bit prime field
brainpoolP224t1: RFC 5639 curve over a 224 bit prime field
brainpoolP256r1: RFC 5639 curve over a 256 bit prime field
brainpoolP256t1: RFC 5639 curve over a 256 bit prime field
brainpoolP320r1: RFC 5639 curve over a 320 bit prime field
brainpoolP320t1: RFC 5639 curve over a 320 bit prime field
brainpoolP384r1: RFC 5639 curve over a 384 bit prime field
brainpoolP384t1: RFC 5639 curve over a 384 bit prime field
brainpoolP512r1: RFC 5639 curve over a 512 bit prime field
brainpoolP512t1: RFC 5639 curve over a 512 bit prime field
SM2 : SM2 curve over a 256 bit prime field

openssl 生成EC 参数文件

openssl ecparam -name secp256k1

-----BEGIN EC PARAMETERS-----
BgUrgQQACg==
-----END EC PARAMETERS-----

openssl ecparam -name secp256k1 -out secp256k1.pem

openssl 查看同线的基点(Generator),阶(Order)

openssl ecparam -in secp256k1.pem -text -param_enc explicit -noout

Field Type: prime-field
Prime:
00:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:
ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:fe:ff:
ff:fc:2f
A: 0
B: 7 (0x7)
Generator (uncompressed):
04:79:be:66:7e:f9:dc:bb:ac:55:a0:62:95:ce:87:
0b:07:02:9b:fc:db:2d:ce:28:d9:59:f2:81:5b:16:
f8:17:98:48:3a:da:77:26:a3:c4:65:5d:a4:fb:fc:
0e:11:08:a8:fd:17:b4:48:a6:85:54:19:9c:47:d0:
8f:fb:10:d4:b8
Order:
00:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:
ff:fe:ba:ae:dc:e6:af:48:a0:3b:bf:d2:5e:8c:d0:
36:41:41
Cofactor: 1 (0x1)

openssl 查看 NISTp256的曲线参数

openssl ecparam -name prime256v1
openssl ecparam -name prime256v1 -out prime256v1.pem

openssl ecparam -in prime256v1.pem -text -param_enc explicit -noout

Field Type: prime-field
Prime:
00:ff:ff:ff:ff:00:00:00:01:00:00:00:00:00:00:
00:00:00:00:00:00:ff:ff:ff:ff:ff:ff:ff:ff:ff:
ff:ff:ff
A:
00:ff:ff:ff:ff:00:00:00:01:00:00:00:00:00:00:
00:00:00:00:00:00:ff:ff:ff:ff:ff:ff:ff:ff:ff:
ff:ff:fc
B:
5a:c6:35:d8:aa:3a:93:e7:b3:eb:bd:55:76:98:86:
bc:65:1d:06:b0:cc:53:b0:f6:3b:ce:3c:3e:27:d2:
60:4b
Generator (uncompressed):
04:6b:17:d1:f2:e1:2c:42:47:f8:bc:e6:e5:63:a4:
40:f2:77:03:7d:81:2d:eb:33:a0:f4:a1:39:45:d8:
98:c2:96:4f:e3:42:e2:fe:1a:7f:9b:8e:e7:eb:4a:
7c:0f:9e:16:2b:ce:33:57:6b:31:5e:ce:cb:b6:40:
68:37:bf:51:f5
Order:
00:ff:ff:ff:ff:00:00:00:00:ff:ff:ff:ff:ff:ff:
ff:ff:bc:e6:fa:ad:a7:17:9e:84:f3:b9:ca:c2:fc:
63:25:51
Cofactor: 1 (0x1)
Seed:
c4:9d:36:08:86:e7:04:93:6a:66:78:e1:13:9d:26:
b7:81:9f:7e:90

openssl 查看 SM2曲线的参数

openssl ecparam -name SM2 -out SM2.pem
openssl ecparam -in SM2.pem -text -param_enc explicit -noout

Field Type: prime-field
Prime:
00:ff:ff:ff:fe:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:
ff:ff:ff:ff:ff:ff:00:00:00:00:ff:ff:ff:ff:ff:
ff:ff:ff
A:
00:ff:ff:ff:fe:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:
ff:ff:ff:ff:ff:ff:00:00:00:00:ff:ff:ff:ff:ff:
ff:ff:fc
B:
28:e9:fa:9e:9d:9f:5e:34:4d:5a:9e:4b:cf:65:09:
a7:f3:97:89:f5:15:ab:8f:92:dd:bc:bd:41:4d:94:
0e:93
Generator (uncompressed):
04:32:c4:ae:2c:1f:19:81:19:5f:99:04:46:6a:39:
c9:94:8f:e3:0b:bf:f2:66:0b:e1:71:5a:45:89:33:
4c:74:c7:bc:37:36:a2:f4:f6:77:9c:59:bd:ce:e3:
6b:69:21:53:d0:a9:87:7c:c6:2a:47:40:02:df:32:
e5:21:39:f0:a0
Order:
00:ff:ff:ff:fe:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:
ff:ff:72:03:df:6b:21:c6:05:2b:53:bb:f4:09:39:
d5:41:23
Cofactor: 1 (0x1)

openssl 生成EC 私钥

openssl ecparam -in secp256k1.pem -genkey -noout -out secp256k1-key.pem
openssl ecparam -name secp256k1 -genkey -noout -out secp256k1-key.pem
cat secp256k1-key.pem 

-----BEGIN EC PRIVATE KEY-----
MHQCAQEEIC3sGk59MeFBA4sZQLJ2XHzhSIhFMmsxJChp6TKfrAtOoAcGBSuBBAAK
oUQDQgAExrW0lB2mH5ROP6u7eTH7N4/SKBRn9CGyS/p/3hMTjOGz3vwnH+35ymmv
+HiERIl7Zy+EfACJ6EO8fSTGrI8jrA==
-----END EC PRIVATE KEY-----

openssl ecparam -in SM2.pem -text -noout

ASN1 OID: SM2

openssl ecparam -in secp256k1.pem -text -noout

ASN1 OID: secp256k1

openssl EC 根据私钥生成公钥

openssl ec -in secp256k1-key.pem -pubout

read EC key
writing EC key
-----BEGIN PUBLIC KEY-----
MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAExrW0lB2mH5ROP6u7eTH7N4/SKBRn9CGy
S/p/3hMTjOGz3vwnH+35ymmv+HiERIl7Zy+EfACJ6EO8fSTGrI8jrA==
-----END PUBLIC KEY-----

openssl ec -in secp256k1-key.pem -pubout -out secp256k1-pubkey.pem

cat secp256k1-pubkey.pem
-----BEGIN PUBLIC KEY-----
MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAExrW0lB2mH5ROP6u7eTH7N4/SKBRn9CGy
S/p/3hMTjOGz3vwnH+35ymmv+HiERIl7Zy+EfACJ6EO8fSTGrI8jrA==
-----END PUBLIC KEY-----

openssl ec -in secp256k1-key.pem -pubout -outform DER -out secp256k1-key.der

openssl ec 帮助查看 

openssl ecparam help
openssl ec help

aes-cbc.test-vectors

  • Set 1 vector 1

mode=aes-128
key=2b7e151628aed2a6abf7158809cf4f3c
iv=000102030405060708090A0B0C0D0E0F
plain=6bc1bee22e409f96e93d7e117393172a
cipher=7649abac8119b246cee98e9b12e9197d

  • Set 1 vector 2

mode=aes-128
key=2b7e151628aed2a6abf7158809cf4f3c
iv=7649ABAC8119B246CEE98E9B12E9197D
plain=ae2d8a571e03ac9c9eb76fac45af8e51
cipher=5086cb9b507219ee95db113a917678b2

  • Set 1 vector 3

mode=aes-128
key=2b7e151628aed2a6abf7158809cf4f3c
iv=5086CB9B507219EE95DB113A917678B2
plain=30c81c46a35ce411e5fbc1191a0a52ef
cipher=73bed6b8e3c1743b7116e69e22229516

  • Set 1 vector 4

mode=aes-128
key=2b7e151628aed2a6abf7158809cf4f3c
iv=73BED6B8E3C1743B7116E69E22229516
plain=f69f2445df4f9b17ad2b417be66c3710
cipher=3ff1caa1681fac09120eca307586e1a7

  • Set 2 vector 1

mode=aes-192
key=8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b
iv=000102030405060708090A0B0C0D0E0F
plain=6bc1bee22e409f96e93d7e117393172a
cipher=4f021db243bc633d7178183a9fa071e8

  • Set 2 vector 2

mode=aes-192
key=8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b
iv=4F021DB243BC633D7178183A9FA071E8
plain=ae2d8a571e03ac9c9eb76fac45af8e51
cipher=b4d9ada9ad7dedf4e5e738763f69145a

  • Set 2 vector 3

mode=aes-192
key=8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b
iv=B4D9ADA9AD7DEDF4E5E738763F69145A
plain=30c81c46a35ce411e5fbc1191a0a52ef
cipher=571b242012fb7ae07fa9baac3df102e0

  • Set 2 vector 4

mode=aes-192
key=8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b
iv=571B242012FB7AE07FA9BAAC3DF102E0
plain=f69f2445df4f9b17ad2b417be66c3710
cipher=08b0e27988598881d920a9e64f5615cd

  • Set 3 vector 1

mode=aes-256
key=603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4
iv=000102030405060708090A0B0C0D0E0F
plain=6bc1bee22e409f96e93d7e117393172a
cipher=f58c4c04d6e5f1ba779eabfb5f7bfbd6

  • Set 3 vector 2

mode=aes-256
key=603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4
iv=F58C4C04D6E5F1BA779EABFB5F7BFBD6
plain=ae2d8a571e03ac9c9eb76fac45af8e51
cipher=9cfc4e967edb808d679f777bc6702c7d

  • Set 3 vector 3

mode=aes-256
key=603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4
iv=9CFC4E967EDB808D679F777BC6702C7D
plain=30c81c46a35ce411e5fbc1191a0a52ef
cipher=39f23369a9d9bacfa530e26304231461

  • Set 3 vector 4

mode=aes-256
key=603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4
iv=39F23369A9D9BACFA530E26304231461
plain=f69f2445df4f9b17ad2b417be66c3710
cipher=b2eb05e2c39be9fcda6c19078c6a9d1b

aes-cfb.test-vectors

  • Set 1 vector 1

mode=aes-128
key=2b7e151628aed2a6abf7158809cf4f3c
iv=000102030405060708090A0B0C0D0E0F
plain=6bc1bee22e409f96e93d7e117393172a
cipher=3b3fd92eb72dad20333449f8e83cfb4a

  • Set 1 vector 2

mode=aes-128
key=2b7e151628aed2a6abf7158809cf4f3c
iv=3B3FD92EB72DAD20333449F8E83CFB4A
plain=ae2d8a571e03ac9c9eb76fac45af8e51
cipher=c8a64537a0b3a93fcde3cdad9f1ce58b

  • Set 1 vector 3

mode=aes-128
key=2b7e151628aed2a6abf7158809cf4f3c
iv=C8A64537A0B3A93FCDE3CDAD9F1CE58B
plain=30c81c46a35ce411e5fbc1191a0a52ef
cipher=26751f67a3cbb140b1808cf187a4f4df

  • Set 1 vector 4

mode=aes-128
key=2b7e151628aed2a6abf7158809cf4f3c
iv=26751F67A3CBB140B1808CF187A4F4DF
plain=f69f2445df4f9b17ad2b417be66c3710
cipher=c04b05357c5d1c0eeac4c66f9ff7f2e6

  • Set 2 vector 1

mode=aes-192
key=8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b
iv=000102030405060708090A0B0C0D0E0F
plain=6bc1bee22e409f96e93d7e117393172a
cipher=cdc80d6fddf18cab34c25909c99a4174

  • Set 2 vector 2

mode=aes-192
key=8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b
iv=CDC80D6FDDF18CAB34C25909C99A4174
plain=ae2d8a571e03ac9c9eb76fac45af8e51
cipher=67ce7f7f81173621961a2b70171d3d7a

  • Set 2 vector 3

mode=aes-192
key=8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b
iv=67CE7F7F81173621961A2B70171D3D7A
plain=30c81c46a35ce411e5fbc1191a0a52ef
cipher=2e1e8a1dd59b88b1c8e60fed1efac4c9

  • Set 2 vector 4

mode=aes-192
key=8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b
iv=2E1E8A1DD59B88B1C8E60FED1EFAC4C9
plain=f69f2445df4f9b17ad2b417be66c3710
cipher=c05f9f9ca9834fa042ae8fba584b09ff

  • Set 3 vector 1

mode=aes-256
key=603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4
iv=000102030405060708090A0B0C0D0E0F
plain=6bc1bee22e409f96e93d7e117393172a
cipher=DC7E84BFDA79164B7ECD8486985D3860

  • Set 3 vector 2

mode=aes-256
key=603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4
iv=DC7E84BFDA79164B7ECD8486985D3860
plain=ae2d8a571e03ac9c9eb76fac45af8e51
cipher=39ffed143b28b1c832113c6331e5407b

  • Set 3 vector 3

mode=aes-256
key=603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4
iv=39FFED143B28B1C832113C6331E5407B
plain=30c81c46a35ce411e5fbc1191a0a52ef
cipher=df10132415e54b92a13ed0a8267ae2f9

  • Set 3 vector 4

mode=aes-256
key=603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4
iv=DF10132415E54B92A13ED0A8267AE2F9
plain=f69f2445df4f9b17ad2b417be66c3710
cipher=75a385741ab9cef82031623d55b1e471

aes-ctr.test-vectors

  • Set 1 vector 1

mode=aes-128
key=2b7e151628aed2a6abf7158809cf4f3c
iv=f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
plain=6bc1bee22e409f96e93d7e117393172a
cipher=874d6191b620e3261bef6864990db6ce

  • Set 1 vector 2

mode=aes-128
key=2b7e151628aed2a6abf7158809cf4f3c
iv=f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
plain=ae2d8a571e03ac9c9eb76fac45af8e51
cipher=9806f66b7970fdff8617187bb9fffdff

  • Set 1 vector 3

mode=aes-128
key=2b7e151628aed2a6abf7158809cf4f3c
iv=f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
plain=30c81c46a35ce411e5fbc1191a0a52ef
cipher=5ae4df3edbd5d35e5b4f09020db03eab

  • Set 1 vector 4

mode=aes-128
key=2b7e151628aed2a6abf7158809cf4f3c
iv=f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
plain=f69f2445df4f9b17ad2b417be66c3710
cipher=1e031dda2fbe03d1792170a0f3009cee

  • Set 2 vector 1

mode=aes-192
key=8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b
iv=f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
plain=6bc1bee22e409f96e93d7e117393172a
cipher=1abc932417521ca24f2b0459fe7e6e0b

  • Set 2 vector 2

mode=aes-192
key=8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b
iv=f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
plain=ae2d8a571e03ac9c9eb76fac45af8e51
cipher=090339ec0aa6faefd5ccc2c6f4ce8e94

  • Set 2 vector 3

mode=aes-192
key=8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b
iv=f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
plain=30c81c46a35ce411e5fbc1191a0a52ef
cipher=1e36b26bd1ebc670d1bd1d665620abf7

  • Set 2 vector 4

mode=aes-192
key=8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b
iv=f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
plain=f69f2445df4f9b17ad2b417be66c3710
cipher=4f78a7f6d29809585a97daec58c6b050

  • Set 3 vector 1

mode=aes-256
key=603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4
iv=f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
plain=6bc1bee22e409f96e93d7e117393172a
cipher=601ec313775789a5b7a7f504bbf3d228

  • Set 3 vector 2

mode=aes-256
key=603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4
iv=f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
plain=ae2d8a571e03ac9c9eb76fac45af8e51
cipher=f443e3ca4d62b59aca84e990cacaf5c5

  • Set 3 vector 3

mode=aes-256
key=603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4
iv=f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
plain=30c81c46a35ce411e5fbc1191a0a52ef
cipher=2b0930daa23de94ce87017ba2d84988d

  • Set 3 vector 4

mode=aes-256
key=603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4
iv=f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
plain=f69f2445df4f9b17ad2b417be66c3710
cipher=dfc9c58db67aada613c2dd08457941a6

aes-ecb.test-vectors

  • Set 1 vector 1

mode=aes-128
key=2b7e151628aed2a6abf7158809cf4f3c
iv=
plain=6bc1bee22e409f96e93d7e117393172a
cipher=3ad77bb40d7a3660a89ecaf32466ef97

  • Set 1 vector 2

mode=aes-128
key=2b7e151628aed2a6abf7158809cf4f3c
iv=
plain=ae2d8a571e03ac9c9eb76fac45af8e51
cipher=f5d3d58503b9699de785895a96fdbaaf

  • Set 1 vector 3

mode=aes-128
key=2b7e151628aed2a6abf7158809cf4f3c
iv=
plain=30c81c46a35ce411e5fbc1191a0a52ef
cipher=43b1cd7f598ece23881b00e3ed030688

  • Set 1 vector 4

mode=aes-128
key=2b7e151628aed2a6abf7158809cf4f3c
iv=
plain=f69f2445df4f9b17ad2b417be66c3710
cipher=7b0c785e27e8ad3f8223207104725dd4

  • Set 2 vector 1

mode=aes-192
key=8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b
iv=
plain=6bc1bee22e409f96e93d7e117393172a
cipher=bd334f1d6e45f25ff712a214571fa5cc

  • Set 2 vector 2

mode=aes-192
key=8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b
iv=
plain=ae2d8a571e03ac9c9eb76fac45af8e51
cipher=974104846d0ad3ad7734ecb3ecee4eef

  • Set 2 vector 3

mode=aes-192
key=8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b
iv=
plain=30c81c46a35ce411e5fbc1191a0a52ef
cipher=ef7afd2270e2e60adce0ba2face6444e

  • Set 2 vector 4

mode=aes-192
key=8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b
iv=
plain=f69f2445df4f9b17ad2b417be66c3710
cipher=9a4b41ba738d6c72fb16691603c18e0e

  • Set 3 vector 1

mode=aes-256
key=603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4
iv=
plain=6bc1bee22e409f96e93d7e117393172a
cipher=f3eed1bdb5d2a03c064b5a7e3db181f8

  • Set 3 vector 2

mode=aes-256
key=603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4
iv=
plain=ae2d8a571e03ac9c9eb76fac45af8e51
cipher=591ccb10d410ed26dc5ba74a31362870

  • Set 3 vector 3

mode=aes-256
key=603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4
iv=
plain=30c81c46a35ce411e5fbc1191a0a52ef
cipher=b6ed21b99ca6f4f9f153e7b1beafed1d

  • Set 3 vector 4

mode=aes-256
key=603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4
iv=
plain=f69f2445df4f9b17ad2b417be66c3710
cipher=23304b7a39f9f3ff067d8d8f9e24ecc7

aes-ofb.test-vectors

  • Set 1 vector 1

mode=aes-128
key=2b7e151628aed2a6abf7158809cf4f3c
iv=000102030405060708090A0B0C0D0E0F
plain=6bc1bee22e409f96e93d7e117393172a
cipher=3b3fd92eb72dad20333449f8e83cfb4a

  • Set 1 vector 2

mode=aes-128
key=2b7e151628aed2a6abf7158809cf4f3c
iv=50FE67CC996D32B6DA0937E99BAFEC60
plain=ae2d8a571e03ac9c9eb76fac45af8e51
cipher=7789508d16918f03f53c52dac54ed825

  • Set 1 vector 3

mode=aes-128
key=2b7e151628aed2a6abf7158809cf4f3c
iv=D9A4DADA0892239F6B8B3D7680E15674
plain=30c81c46a35ce411e5fbc1191a0a52ef
cipher=9740051e9c5fecf64344f7a82260edcc

  • Set 1 vector 4

mode=aes-128
key=2b7e151628aed2a6abf7158809cf4f3c
iv=A78819583F0308E7A6BF36B1386ABF23
plain=f69f2445df4f9b17ad2b417be66c3710
cipher=304c6528f659c77866a510d9c1d6ae5e

  • Set 2 vector 1

mode=aes-192
key=8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b
iv=000102030405060708090A0B0C0D0E0F
plain=6bc1bee22e409f96e93d7e117393172a
cipher=cdc80d6fddf18cab34c25909c99a4174

  • Set 2 vector 2

mode=aes-192
key=8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b
iv=A609B38DF3B1133DDDFF2718BA09565E
plain=ae2d8a571e03ac9c9eb76fac45af8e51
cipher=fcc28b8d4c63837c09e81700c1100401

  • Set 2 vector 3

mode=aes-192
key=8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b
iv=52EF01DA52602FE0975F78AC84BF8A50
plain=30c81c46a35ce411e5fbc1191a0a52ef
cipher=8d9a9aeac0f6596f559c6d4daf59a5f2

  • Set 2 vector 4

mode=aes-192
key=8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b
iv=BD5286AC63AABD7EB067AC54B553F71D
plain=f69f2445df4f9b17ad2b417be66c3710
cipher=6d9f200857ca6c3e9cac524bd9acc92a

  • Set 3 vector 1

mode=aes-256
key=603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4
iv=000102030405060708090A0B0C0D0E0F
plain=6bc1bee22e409f96e93d7e117393172a
cipher=dc7e84bfda79164b7ecd8486985d3860

  • Set 3 vector 2

mode=aes-256
key=603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4
iv=B7BF3A5DF43989DD97F0FA97EBCE2F4A
plain=ae2d8a571e03ac9c9eb76fac45af8e51
cipher=4febdc6740d20b3ac88f6ad82a4fb08d

  • Set 3 vector 3

mode=aes-256
key=603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4
iv=E1C656305ED1A7A6563805746FE03EDC
plain=30c81c46a35ce411e5fbc1191a0a52ef
cipher=71ab47a086e86eedf39d1c5bba97c408

  • Set 3 vector 4

mode=aes-256
key=603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4
iv=41635BE625B48AFC1666DD42A09D96E7
plain=f69f2445df4f9b17ad2b417be66c3710
cipher=0126141d67f37be8538f5a8be740e484

来自苹果公司的aes test vectors

https://opensource.apple.com/source/OpenSSL/OpenSSL-23/openssl/test/evptests.txt

cipher:key:iv:plaintext:ciphertext:0/1(decrypt/encrypt)
digest:::input:output

SHA(1) tests (from shatest.c)
SHA1:::616263:a9993e364706816aba3e25717850c26c9cd0d89d

MD5 tests (from md5test.c)
MD5::::d41d8cd98f00b204e9800998ecf8427e
MD5:::61:0cc175b9c0f1b6a831c399e269772661
MD5:::616263:900150983cd24fb0d6963f7d28e17f72
MD5:::6d65737361676520646967657374:f96b697d7cb7938d525a2f31aaf161d0
MD5:::6162636465666768696a6b6c6d6e6f707172737475767778797a:c3fcd3d76192e4007dfb496cca67e13b
MD5:::4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a30313233343536373839:d174ab98d277d9f5a5611c2c9f419d9f
MD5:::3132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930:57edf4a22be3c955ac49da2e2107b67a

AES 128 ECB tests (from FIPS-197 test vectors, encrypt)

AES-128-ECB:000102030405060708090A0B0C0D0E0F::00112233445566778899AABBCCDDEEFF:69C4E0D86A7B0430D8CDB78070B4C55A:1

AES 192 ECB tests (from FIPS-197 test vectors, encrypt)

AES-192-ECB:000102030405060708090A0B0C0D0E0F1011121314151617::00112233445566778899AABBCCDDEEFF:DDA97CA4864CDFE06EAF70A0EC0D7191:1

AES 256 ECB tests (from FIPS-197 test vectors, encrypt)

AES-256-ECB:000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F::00112233445566778899AABBCCDDEEFF:8EA2B7CA516745BFEAFC49904B496089:1

AES 128 ECB tests (from NIST test vectors, encrypt)

AES-128-ECB:00000000000000000000000000000000::00000000000000000000000000000000:C34C052CC0DA8D73451AFE5F03BE297F:1

AES 128 ECB tests (from NIST test vectors, decrypt)

AES-128-ECB:00000000000000000000000000000000::44416AC2D1F53C583303917E6BE9EBE0:00000000000000000000000000000000:0

AES 192 ECB tests (from NIST test vectors, decrypt)

AES-192-ECB:000000000000000000000000000000000000000000000000::48E31E9E256718F29229319C19F15BA4:00000000000000000000000000000000:0

AES 256 ECB tests (from NIST test vectors, decrypt)

AES-256-ECB:0000000000000000000000000000000000000000000000000000000000000000::058CCFFDBBCB382D1F6F56585D8A4ADE:00000000000000000000000000000000:0

AES 128 CBC tests (from NIST test vectors, encrypt)

AES-128-CBC:00000000000000000000000000000000:00000000000000000000000000000000:00000000000000000000000000000000:8A05FC5E095AF4848A08D328D3688E3D:1

AES 192 CBC tests (from NIST test vectors, encrypt)

AES-192-CBC:000000000000000000000000000000000000000000000000:00000000000000000000000000000000:00000000000000000000000000000000:7BD966D53AD8C1BB85D2ADFAE87BB104:1

AES 256 CBC tests (from NIST test vectors, encrypt)

AES-256-CBC:0000000000000000000000000000000000000000000000000000000000000000:00000000000000000000000000000000:00000000000000000000000000000000:FE3C53653E2F45B56FCD88B2CC898FF0:1

AES 128 CBC tests (from NIST test vectors, decrypt)

AES-128-CBC:00000000000000000000000000000000:00000000000000000000000000000000:FACA37E0B0C85373DF706E73F7C9AF86:00000000000000000000000000000000:0

AES tests from NIST document SP800-38A
For all ECB encrypts and decrypts, the transformed sequence is
AES-bits-ECB:key::plaintext:ciphertext:encdec
ECB-AES128.Encrypt and ECB-AES128.Decrypt
AES-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::6BC1BEE22E409F96E93D7E117393172A:3AD77BB40D7A3660A89ECAF32466EF97
AES-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::AE2D8A571E03AC9C9EB76FAC45AF8E51:F5D3D58503B9699DE785895A96FDBAAF
AES-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::30C81C46A35CE411E5FBC1191A0A52EF:43B1CD7F598ECE23881B00E3ED030688
AES-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::F69F2445DF4F9B17AD2B417BE66C3710:7B0C785E27E8AD3F8223207104725DD4
ECB-AES192.Encrypt and ECB-AES192.Decrypt
AES-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::6BC1BEE22E409F96E93D7E117393172A:BD334F1D6E45F25FF712A214571FA5CC
AES-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::AE2D8A571E03AC9C9EB76FAC45AF8E51:974104846D0AD3AD7734ECB3ECEE4EEF
AES-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::30C81C46A35CE411E5FBC1191A0A52EF:EF7AFD2270E2E60ADCE0BA2FACE6444E
AES-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::F69F2445DF4F9B17AD2B417BE66C3710:9A4B41BA738D6C72FB16691603C18E0E
ECB-AES256.Encrypt and ECB-AES256.Decrypt
AES-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4::6BC1BEE22E409F96E93D7E117393172A:F3EED1BDB5D2A03C064B5A7E3DB181F8
AES-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4::AE2D8A571E03AC9C9EB76FAC45AF8E51:591CCB10D410ED26DC5BA74A31362870
AES-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4::30C81C46A35CE411E5FBC1191A0A52EF:B6ED21B99CA6F4F9F153E7B1BEAFED1D
AES-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4::F69F2445DF4F9B17AD2B417BE66C3710:23304B7A39F9F3FF067D8D8F9E24ECC7
For all CBC encrypts and decrypts, the transformed sequence is
AES-bits-CBC:key:IV/ciphertext':plaintext:ciphertext:encdec
CBC-AES128.Encrypt and CBC-AES128.Decrypt
AES-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:7649ABAC8119B246CEE98E9B12E9197D
AES-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:7649ABAC8119B246CEE98E9B12E9197D:AE2D8A571E03AC9C9EB76FAC45AF8E51:5086CB9B507219EE95DB113A917678B2
AES-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:5086CB9B507219EE95DB113A917678B2:30C81C46A35CE411E5FBC1191A0A52EF:73BED6B8E3C1743B7116E69E22229516
AES-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:73BED6B8E3C1743B7116E69E22229516:F69F2445DF4F9B17AD2B417BE66C3710:3FF1CAA1681FAC09120ECA307586E1A7
CBC-AES192.Encrypt and CBC-AES192.Decrypt
AES-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:4F021DB243BC633D7178183A9FA071E8
AES-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:4F021DB243BC633D7178183A9FA071E8:AE2D8A571E03AC9C9EB76FAC45AF8E51:B4D9ADA9AD7DEDF4E5E738763F69145A
AES-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:B4D9ADA9AD7DEDF4E5E738763F69145A:30C81C46A35CE411E5FBC1191A0A52EF:571B242012FB7AE07FA9BAAC3DF102E0
AES-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:571B242012FB7AE07FA9BAAC3DF102E0:F69F2445DF4F9B17AD2B417BE66C3710:08B0E27988598881D920A9E64F5615CD
CBC-AES256.Encrypt and CBC-AES256.Decrypt
AES-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:F58C4C04D6E5F1BA779EABFB5F7BFBD6
AES-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:F58C4C04D6E5F1BA779EABFB5F7BFBD6:AE2D8A571E03AC9C9EB76FAC45AF8E51:9CFC4E967EDB808D679F777BC6702C7D
AES-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:9CFC4E967EDB808D679F777BC6702C7D:30C81C46A35CE411E5FBC1191A0A52EF:39F23369A9D9BACFA530E26304231461
AES-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:39F23369A9D9BACFA530E26304231461:F69F2445DF4F9B17AD2B417BE66C3710:B2EB05E2C39BE9FCDA6C19078C6A9D1B
We don't support CFB{1,8}-AESxxx.{En,De}crypt
For all CFB128 encrypts and decrypts, the transformed sequence is
AES-bits-CFB:key:IV/ciphertext':plaintext:ciphertext:encdec
CFB128-AES128.Encrypt
AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:3B3FD92EB72DAD20333449F8E83CFB4A:1
AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:3B3FD92EB72DAD20333449F8E83CFB4A:AE2D8A571E03AC9C9EB76FAC45AF8E51:C8A64537A0B3A93FCDE3CDAD9F1CE58B:1
AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:C8A64537A0B3A93FCDE3CDAD9F1CE58B:30C81C46A35CE411E5FBC1191A0A52EF:26751F67A3CBB140B1808CF187A4F4DF:1
AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:26751F67A3CBB140B1808CF187A4F4DF:F69F2445DF4F9B17AD2B417BE66C3710:C04B05357C5D1C0EEAC4C66F9FF7F2E6:1
CFB128-AES128.Decrypt
AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:3B3FD92EB72DAD20333449F8E83CFB4A:0
AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:3B3FD92EB72DAD20333449F8E83CFB4A:AE2D8A571E03AC9C9EB76FAC45AF8E51:C8A64537A0B3A93FCDE3CDAD9F1CE58B:0
AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:C8A64537A0B3A93FCDE3CDAD9F1CE58B:30C81C46A35CE411E5FBC1191A0A52EF:26751F67A3CBB140B1808CF187A4F4DF:0
AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:26751F67A3CBB140B1808CF187A4F4DF:F69F2445DF4F9B17AD2B417BE66C3710:C04B05357C5D1C0EEAC4C66F9FF7F2E6:0
CFB128-AES192.Encrypt
AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CDC80D6FDDF18CAB34C25909C99A4174:1
AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:CDC80D6FDDF18CAB34C25909C99A4174:AE2D8A571E03AC9C9EB76FAC45AF8E51:67CE7F7F81173621961A2B70171D3D7A:1
AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:67CE7F7F81173621961A2B70171D3D7A:30C81C46A35CE411E5FBC1191A0A52EF:2E1E8A1DD59B88B1C8E60FED1EFAC4C9:1
AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:2E1E8A1DD59B88B1C8E60FED1EFAC4C9:F69F2445DF4F9B17AD2B417BE66C3710:C05F9F9CA9834FA042AE8FBA584B09FF:1
CFB128-AES192.Decrypt
AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CDC80D6FDDF18CAB34C25909C99A4174:0
AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:CDC80D6FDDF18CAB34C25909C99A4174:AE2D8A571E03AC9C9EB76FAC45AF8E51:67CE7F7F81173621961A2B70171D3D7A:0
AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:67CE7F7F81173621961A2B70171D3D7A:30C81C46A35CE411E5FBC1191A0A52EF:2E1E8A1DD59B88B1C8E60FED1EFAC4C9:0
AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:2E1E8A1DD59B88B1C8E60FED1EFAC4C9:F69F2445DF4F9B17AD2B417BE66C3710:C05F9F9CA9834FA042AE8FBA584B09FF:0
CFB128-AES256.Encrypt
AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:DC7E84BFDA79164B7ECD8486985D3860:1
AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:DC7E84BFDA79164B7ECD8486985D3860:AE2D8A571E03AC9C9EB76FAC45AF8E51:39FFED143B28B1C832113C6331E5407B:1
AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:39FFED143B28B1C832113C6331E5407B:30C81C46A35CE411E5FBC1191A0A52EF:DF10132415E54B92A13ED0A8267AE2F9:1
AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:DF10132415E54B92A13ED0A8267AE2F9:F69F2445DF4F9B17AD2B417BE66C3710:75A385741AB9CEF82031623D55B1E471:1
CFB128-AES256.Decrypt
AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:DC7E84BFDA79164B7ECD8486985D3860:0
AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:DC7E84BFDA79164B7ECD8486985D3860:AE2D8A571E03AC9C9EB76FAC45AF8E51:39FFED143B28B1C832113C6331E5407B:0
AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:39FFED143B28B1C832113C6331E5407B:30C81C46A35CE411E5FBC1191A0A52EF:DF10132415E54B92A13ED0A8267AE2F9:0
AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:DF10132415E54B92A13ED0A8267AE2F9:F69F2445DF4F9B17AD2B417BE66C3710:75A385741AB9CEF82031623D55B1E471:0
For all OFB encrypts and decrypts, the transformed sequence is
AES-bits-CFB:key:IV/output':plaintext:ciphertext:encdec
OFB-AES128.Encrypt
AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:3B3FD92EB72DAD20333449F8E83CFB4A:1
AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:50FE67CC996D32B6DA0937E99BAFEC60:AE2D8A571E03AC9C9EB76FAC45AF8E51:7789508D16918F03F53C52DAC54ED825:1
AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:D9A4DADA0892239F6B8B3D7680E15674:30C81C46A35CE411E5FBC1191A0A52EF:9740051E9C5FECF64344F7A82260EDCC:1
AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:A78819583F0308E7A6BF36B1386ABF23:F69F2445DF4F9B17AD2B417BE66C3710:304C6528F659C77866A510D9C1D6AE5E:1
OFB-AES128.Decrypt
AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:3B3FD92EB72DAD20333449F8E83CFB4A:0
AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:50FE67CC996D32B6DA0937E99BAFEC60:AE2D8A571E03AC9C9EB76FAC45AF8E51:7789508D16918F03F53C52DAC54ED825:0
AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:D9A4DADA0892239F6B8B3D7680E15674:30C81C46A35CE411E5FBC1191A0A52EF:9740051E9C5FECF64344F7A82260EDCC:0
AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:A78819583F0308E7A6BF36B1386ABF23:F69F2445DF4F9B17AD2B417BE66C3710:304C6528F659C77866A510D9C1D6AE5E:0
OFB-AES192.Encrypt
AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CDC80D6FDDF18CAB34C25909C99A4174:1
AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:A609B38DF3B1133DDDFF2718BA09565E:AE2D8A571E03AC9C9EB76FAC45AF8E51:FCC28B8D4C63837C09E81700C1100401:1
AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:52EF01DA52602FE0975F78AC84BF8A50:30C81C46A35CE411E5FBC1191A0A52EF:8D9A9AEAC0F6596F559C6D4DAF59A5F2:1
AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:BD5286AC63AABD7EB067AC54B553F71D:F69F2445DF4F9B17AD2B417BE66C3710:6D9F200857CA6C3E9CAC524BD9ACC92A:1
OFB-AES192.Decrypt
AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CDC80D6FDDF18CAB34C25909C99A4174:0
AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:A609B38DF3B1133DDDFF2718BA09565E:AE2D8A571E03AC9C9EB76FAC45AF8E51:FCC28B8D4C63837C09E81700C1100401:0
AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:52EF01DA52602FE0975F78AC84BF8A50:30C81C46A35CE411E5FBC1191A0A52EF:8D9A9AEAC0F6596F559C6D4DAF59A5F2:0
AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:BD5286AC63AABD7EB067AC54B553F71D:F69F2445DF4F9B17AD2B417BE66C3710:6D9F200857CA6C3E9CAC524BD9ACC92A:0
OFB-AES256.Encrypt
AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:DC7E84BFDA79164B7ECD8486985D3860:1
AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:B7BF3A5DF43989DD97F0FA97EBCE2F4A:AE2D8A571E03AC9C9EB76FAC45AF8E51:4FEBDC6740D20B3AC88F6AD82A4FB08D:1
AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:E1C656305ED1A7A6563805746FE03EDC:30C81C46A35CE411E5FBC1191A0A52EF:71AB47A086E86EEDF39D1C5BBA97C408:1
AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:41635BE625B48AFC1666DD42A09D96E7:F69F2445DF4F9B17AD2B417BE66C3710:0126141D67F37BE8538F5A8BE740E484:1
OFB-AES256.Decrypt
AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:DC7E84BFDA79164B7ECD8486985D3860:0
AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:B7BF3A5DF43989DD97F0FA97EBCE2F4A:AE2D8A571E03AC9C9EB76FAC45AF8E51:4FEBDC6740D20B3AC88F6AD82A4FB08D:0
AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:E1C656305ED1A7A6563805746FE03EDC:30C81C46A35CE411E5FBC1191A0A52EF:71AB47A086E86EEDF39D1C5BBA97C408:0
AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:41635BE625B48AFC1666DD42A09D96E7:F69F2445DF4F9B17AD2B417BE66C3710:0126141D67F37BE8538F5A8BE740E484:0

一般而言,當我們與對方開啟對話時,溝通的目的不外乎以下幾個:

(一)取得資訊:透過探問或表答疑惑,了解他人的想法、觀點或情感狀態,或得到自己目前不清楚的訊息,這是最普遍的溝通目的。

(二)獲得理解:當我們遭遇挫敗,心情沮喪難過時,藉著向別人訴說自己的經歷與心情,能得到別人的理解,而讓受傷的情緒有個療癒的空間。

(三)得到承諾:當我們對別人有所期待,希望別人照著我們的意思做時,透過溝通表達傳遞訊息,而讓對方答應我們的請求或要求。

(四)請求回饋:當我們不確定自己這麼做是否妥當,請求他人給我們一些指點或建議,幫助我們學習、改進或提升。

(五)促成改變:透過給予建議或提供某些觀念或見解,引導、催化或幫助他人表現出不同的行為,以改變目前的處境。

(六)建立連結:透過語言或非語言訊息的表達,與他人發展一段關係,貼近他人的內在世界,促成雙方更緊密的關係連結。如透過同理心或正向回應,讓對方感受到自己是被理解與被重視的,這是所有人際溝通的基礎。

我們會依照我們所側重的溝通目的,選擇適合的溝通途徑與表達內容,以獲得我們想要的結果。若對方的回饋並非我們預期中的,則改變或調整溝通方式再嘗試看看。

然而,許多人卻讓溝通互動成了證明是非對錯的戰場,最後弄得兩敗俱傷,未能發揮任何溝通的效果。

asn1parse 帮助

openssl asn1parse -help
openssl help asn1parse

Usage: asn1parse [options]
Valid options are:
-help Display this summary
-inform PEM|DER input format - one of DER PEM
-in infile input file
-out outfile output file (output format is always DER)
-i indents the output
-noout do not produce any output
-offset +int offset into file
-length +int length of section in file
-oid infile file of extra oid definitions
-dump unknown data in hex form
-dlimit +int dump the first arg bytes of unknown data in hex form
-strparse +int offset; a series of these can be used to 'dig' into multiple ASN1 blob wrappings
-genstr val string to generate ASN1 structure from
-genconf val file to generate ASN1 structure from (-inform will be ignored)
-strictpem do not attempt base64 decode outside PEM markers
-item val item to parse and print

asn1parse genconf 生成der文件
文件test_asn1.conf内容如下: 来自(https://zhuanlan.zhihu.com/p/25488879
asn1 = SEQUENCE:seq_section

[seq_section]
field1 = BOOLEAN:TRUE
field2 = INTEGER:0x01
field3 = SEQUENCE:seq_child

[seq_child]
field1 = INTEGER:0x02
field2 = INTEGER:0x03

上面内容中定义了一个名字为seq_section的SEQUENCE,里面包含了BOOLEAN的元素field1,值为TRUE,INTEGER的元素field2,值为1,同时也包含了seq_child的子SEQUENCE。

根据test_asn1.conf生成test.der

openssl asn1parse -genconf test_asn1.conf -out test_asn1.der

test_asn1.der内容如下:

hexdump -C test_asn1.der 

00000000 30 0e 01 01 ff 02 01 01 30 06 02 01 02 02 01 03 |0.......0.......|

openssl asn1parse -in test_asn1.der -inform der

0:d=0 hl=2 l= 14 cons: SEQUENCE
2:d=1 hl=2 l= 1 prim: BOOLEAN :255
5:d=1 hl=2 l= 1 prim: INTEGER :01
8:d=1 hl=2 l= 6 cons: SEQUENCE
10:d=2 hl=2 l= 1 prim: INTEGER :02
13:d=2 hl=2 l= 1 prim: INTEGER :03

SM2私钥文件解码示例
私钥文件内容如下(密码为111111):

cat test.pfx

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

将test.pfx转码为der

base64 -d test.pfx > test.pfx.der

使用openssl pkcs12 解码

openssl pkcs12 -in test.pfx.der -passin pass:"111111" -nodes -nocerts

Bag Attributes
friendlyName: user key
localKeyID: E8 53 AF 28 9B A6 C0 43 66 15 AB 61 90 BB E6 18 82 68 41 4D
Key Attributes: <No Attributes>
-----BEGIN PRIVATE KEY-----
MIIBGwIBADCB7AYHKoZIzj0CATCB4AIBATAsBgcqhkjOPQEBAiEA/////v//////
//////////////8AAAAA//////////8wRAQg/////v////////////////////8A
AAAA//////////wEICjp+p6dn140TVqeS89lCafzl4n1FauPkt28vUFNlA6TBEEE
MsSuLB8ZgRlfmQRGajnJlI/jC7/yZgvhcVpFiTNMdMe8Nzai9PZ3nFm9zuNraSFT
0KmHfMYqR0AC3zLlITnwoAIhAP////7///////////////9yA99rIcYFK1O79Ak5
1UEjAgEBBCcwJQIBAQQg5+Xxqb6y/gH/RStGmwc9tATHf6MuVpTu+VrB4TVnn5s=
-----END PRIVATE KEY-----

保存私钥为test.pfx.key.pem

cat test.pfx.key.pem 

-----BEGIN PRIVATE KEY-----
MIIBGwIBADCB7AYHKoZIzj0CATCB4AIBATAsBgcqhkjOPQEBAiEA/////v//////
//////////////8AAAAA//////////8wRAQg/////v////////////////////8A
AAAA//////////wEICjp+p6dn140TVqeS89lCafzl4n1FauPkt28vUFNlA6TBEEE
MsSuLB8ZgRlfmQRGajnJlI/jC7/yZgvhcVpFiTNMdMe8Nzai9PZ3nFm9zuNraSFT
0KmHfMYqR0AC3zLlITnwoAIhAP////7///////////////9yA99rIcYFK1O79Ak5
1UEjAgEBBCcwJQIBAQQg5+Xxqb6y/gH/RStGmwc9tATHf6MuVpTu+VrB4TVnn5s=
-----END PRIVATE KEY-----

查看SM2的私钥

openssl ec -in test.pfx.key.pem -text -noout

read EC key
Private-Key: (256 bit)
priv:
e7:e5:f1:a9:be:b2:fe:01:ff:45:2b:46:9b:07:3d:
b4:04:c7:7f:a3:2e:56:94:ee:f9:5a:c1:e1:35:67:
9f:9b
pub:
04:98:e2:4b:18:21:7b:b8:95:b4:07:aa:a2:fa:bb:
4e:2c:64:70:2a:c5:b7:1c:b5:9b:77:c5:6a:f5:e4:
76:89:91:e2:36:1b:3c:bc:1b:80:5f:5b:6f:ee:46:
c8:f4:70:20:c6:ed:04:f8:50:75:23:7e:4c:8f:9a:
ac:d0:75:10:f5
Field Type: prime-field
Prime:
00:ff:ff:ff:fe:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:
ff:ff:ff:ff:ff:ff:00:00:00:00:ff:ff:ff:ff:ff:
ff:ff:ff
A:
00:ff:ff:ff:fe:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:
ff:ff:ff:ff:ff:ff:00:00:00:00:ff:ff:ff:ff:ff:
ff:ff:fc
B:
28:e9:fa:9e:9d:9f:5e:34:4d:5a:9e:4b:cf:65:09:
a7:f3:97:89:f5:15:ab:8f:92:dd:bc:bd:41:4d:94:
0e:93
Generator (uncompressed):
04:32:c4:ae:2c:1f:19:81:19:5f:99:04:46:6a:39:
c9:94:8f:e3:0b:bf:f2:66:0b:e1:71:5a:45:89:33:
4c:74:c7:bc:37:36:a2:f4:f6:77:9c:59:bd:ce:e3:
6b:69:21:53:d0:a9:87:7c:c6:2a:47:40:02:df:32:
e5:21:39:f0:a0
Order:
00:ff:ff:ff:fe:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:
ff:ff:72:03:df:6b:21:c6:05:2b:53:bb:f4:09:39:
d5:41:23
Cofactor: 1 (0x1)

openssl asn1parse打印证书信息

openssl asn1parse -in test.pfx.key.pem

0:d=0 hl=4 l= 283 cons: SEQUENCE
4:d=1 hl=2 l= 1 prim: INTEGER :00
7:d=1 hl=3 l= 236 cons: SEQUENCE
10:d=2 hl=2 l= 7 prim: OBJECT :id-ecPublicKey
19:d=2 hl=3 l= 224 cons: SEQUENCE
22:d=3 hl=2 l= 1 prim: INTEGER :01
25:d=3 hl=2 l= 44 cons: SEQUENCE
27:d=4 hl=2 l= 7 prim: OBJECT :prime-field
36:d=4 hl=2 l= 33 prim: INTEGER :FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFF
71:d=3 hl=2 l= 68 cons: SEQUENCE
73:d=4 hl=2 l= 32 prim: OCTET STRING [HEX DUMP]:FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFC
107:d=4 hl=2 l= 32 prim: OCTET STRING [HEX DUMP]:28E9FA9E9D9F5E344D5A9E4BCF6509A7F39789F515AB8F92DDBCBD414D940E93
141:d=3 hl=2 l= 65 prim: OCTET STRING [HEX DUMP]:0432C4AE2C1F1981195F9904466A39C9948FE30BBFF2660BE1715A4589334C74C7BC3736A2F4F6779C59BDCEE36B692153D0A9877CC62A474002DF32E52139F0A0
208:d=3 hl=2 l= 33 prim: INTEGER :FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFF7203DF6B21C6052B53BBF40939D54123
243:d=3 hl=2 l= 1 prim: INTEGER :01
246:d=1 hl=2 l= 39 prim: OCTET STRING [HEX DUMP]:30250201010420E7E5F1A9BEB2FE01FF452B469B073DB404C77FA32E5694EEF95AC1E135679F9B

使用openssl asn1parse dump
openssl asn1parse -in test.pfx.key.pem -dump

0:d=0 hl=4 l= 283 cons: SEQUENCE
4:d=1 hl=2 l= 1 prim: INTEGER :00
7:d=1 hl=3 l= 236 cons: SEQUENCE
10:d=2 hl=2 l= 7 prim: OBJECT :id-ecPublicKey
19:d=2 hl=3 l= 224 cons: SEQUENCE
22:d=3 hl=2 l= 1 prim: INTEGER :01
25:d=3 hl=2 l= 44 cons: SEQUENCE
27:d=4 hl=2 l= 7 prim: OBJECT :prime-field
36:d=4 hl=2 l= 33 prim: INTEGER :FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFF
71:d=3 hl=2 l= 68 cons: SEQUENCE
73:d=4 hl=2 l= 32 prim: OCTET STRING
0000 - ff ff ff fe ff ff ff ff-ff ff ff ff ff ff ff ff ................
0010 - ff ff ff ff 00 00 00 00-ff ff ff ff ff ff ff fc ................
107:d=4 hl=2 l= 32 prim: OCTET STRING
0000 - 28 e9 fa 9e 9d 9f 5e 34-4d 5a 9e 4b cf 65 09 a7 (.....^4MZ.K.e..
0010 - f3 97 89 f5 15 ab 8f 92-dd bc bd 41 4d 94 0e 93 ...........AM...
141:d=3 hl=2 l= 65 prim: OCTET STRING
0000 - 04 32 c4 ae 2c 1f 19 81-19 5f 99 04 46 6a 39 c9 .2..,...._..Fj9.
0010 - 94 8f e3 0b bf f2 66 0b-e1 71 5a 45 89 33 4c 74 ......f..qZE.3Lt
0020 - c7 bc 37 36 a2 f4 f6 77-9c 59 bd ce e3 6b 69 21 ..76...w.Y...ki!
0030 - 53 d0 a9 87 7c c6 2a 47-40 02 df 32 e5 21 39 f0 S...|.*G@..2.!9.
0040 - a0 .
208:d=3 hl=2 l= 33 prim: INTEGER :FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFF7203DF6B21C6052B53BBF40939D54123
243:d=3 hl=2 l= 1 prim: INTEGER :01
246:d=1 hl=2 l= 39 prim: OCTET STRING
0000 - 30 25 02 01 01 04 20 e7-e5 f1 a9 be b2 fe 01 ff 0%.... .........
0010 - 45 2b 46 9b 07 3d b4 04-c7 7f a3 2e 56 94 ee f9 E+F..=......V...
0020 - 5a c1 e1 35 67 9f 9b Z..5g..

openssl asn1parse strparse 查看SM2曲线的a, b参数

openssl asn1parse -in test.pfx.key.pem -strparse 71 -dump
openssl asn1parse -in test.pfx.key.pem -strparse 71 

0:d=0 hl=2 l= 68 cons: SEQUENCE
2:d=1 hl=2 l= 32 prim: OCTET STRING [HEX DUMP]:FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFC
36:d=1 hl=2 l= 32 prim: OCTET STRING [HEX DUMP]:28E9FA9E9D9F5E344D5A9E4BCF6509A7F39789F515AB8F92DDBCBD414D940E93

openssl asn1parse strparse 查看SM2的私钥

openssl asn1parse -in test.pfx.key.pem -strparse 246

0:d=0 hl=2 l= 37 cons: SEQUENCE
2:d=1 hl=2 l= 1 prim: INTEGER :01
5:d=1 hl=2 l= 32 prim: OCTET STRING [HEX DUMP]:E7E5F1A9BEB2FE01FF452B469B073DB404C77FA32E5694EEF95AC1E135679F9B

openssl asn1parse 结构说明
0:d=0 hl=2 l= 37 cons: SEQUENCE
0 表示节点在整个文件中的偏移长度

d=0 表示节点深度

hl=2 表示节点头字节长度

l=37 表示节点数据字节长度

cons 表示该节点为结构节点,表示包含子节点或者子结构数据

prim 表示该节点为原始节点,包含数据

SEQUENCE、OCTETSTRING等都是ASN.1中定义的数据类型,具体可以参考ASN.1格式说明。

最后一个节点OCTET STRING [HEX DUMP],就是加密后的私钥数据。

参考:
https://www.cnblogs.com/274914765qq/p/4671849.html