mirror of
https://github.com/guanzhi/GmSSL.git
synced 2026-08-09 23:43:41 +08:00
SM2 KAP (Key Agreement Protocol), not tested
This commit is contained in:
37
crypto/sm2/sm2_asn1.c
Normal file
37
crypto/sm2/sm2_asn1.c
Normal file
@@ -0,0 +1,37 @@
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* from GM/T 0009-2012
|
||||
* "SM2 Cryptography Algorithm Application Specification"
|
||||
*
|
||||
SM2PrivateKey ::= INTEGER
|
||||
|
||||
SM2PublicKey ::= BIT STRING
|
||||
|
||||
SM2CiphertextValue ::= SEQUENCE {
|
||||
XCoordinate INTEGER,
|
||||
YCoordinate INTEGER,
|
||||
Hash OCTET STRING SIZE(32),
|
||||
Ciphertext OCTET STRING
|
||||
}
|
||||
|
||||
SM2Signature ::= SEQUENCE {
|
||||
R INTEGER,
|
||||
S INTEGER,
|
||||
}
|
||||
|
||||
SM2EnvelopedKey ::= SEQUENCE {
|
||||
symAlgID AlgorithmIdentifier,
|
||||
symEncryptedKey SM2CiphertextValue,
|
||||
sm2PublicKey SM2PublicKey,
|
||||
sm2EncryptedPrivateKey BIT STRING
|
||||
}
|
||||
|
||||
ZID = SM3(nbits(ID)||ID||a||b||xG||yG||xA||yA)
|
||||
|
||||
Default ID = "1234567812345678"
|
||||
|
||||
*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user