mirror of
https://github.com/emmansun/gmsm.git
synced 2025-04-26 12:16:20 +08:00
SM9: update readme and supplement comment
This commit is contained in:
parent
410b1eea3a
commit
aa9e546638
@ -1,5 +1,11 @@
|
|||||||
SM9 current performance:
|
## SM9 current supported functions:
|
||||||
|
1.Keys generation
|
||||||
|
2.Sign/Verify
|
||||||
|
3.Key Exchange
|
||||||
|
4.Wrap/Unwrap Key
|
||||||
|
5.Encryption/Decryption (XOR mode)
|
||||||
|
|
||||||
|
## SM9 current performance:
|
||||||
|
|
||||||
**SM9 Sign Benchmark**
|
**SM9 Sign Benchmark**
|
||||||
|
|
||||||
|
28
sm9/sm9.go
28
sm9/sm9.go
@ -497,19 +497,21 @@ func (priv *EncryptPrivateKey) Decrypt(uid, ciphertext []byte) ([]byte, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// KeyExchange key exchange struct, include internal stat in whole key exchange flow.
|
// KeyExchange key exchange struct, include internal stat in whole key exchange flow.
|
||||||
|
// Initiator's flow will be: NewKeyExchange -> InitKeyExchange -> transmission -> ConfirmResponder
|
||||||
|
// Responder's flow will be: NewKeyExchange -> waiting ... -> RepondKeyExchange -> transmission -> ConfirmInitiator
|
||||||
type KeyExchange struct {
|
type KeyExchange struct {
|
||||||
genSignature bool
|
genSignature bool // control the optional sign/verify step triggered by responsder
|
||||||
keyLength int
|
keyLength int // key length
|
||||||
privateKey *EncryptPrivateKey
|
privateKey *EncryptPrivateKey // owner's encryption private key
|
||||||
uid []byte
|
uid []byte // owner uid
|
||||||
peerUID []byte
|
peerUID []byte // peer uid
|
||||||
r *big.Int
|
r *big.Int // random which will be used to compute secret
|
||||||
secret *bn256.G1
|
secret *bn256.G1 // generated secret which will be passed to peer
|
||||||
peerSecret *bn256.G1
|
peerSecret *bn256.G1 // received peer's secret
|
||||||
g1 *bn256.GT
|
g1 *bn256.GT // internal state which will be used when compute the key and signature
|
||||||
g2 *bn256.GT
|
g2 *bn256.GT // internal state which will be used when compute the key and signature
|
||||||
g3 *bn256.GT
|
g3 *bn256.GT // internal state which will be used when compute the key and signature
|
||||||
key []byte
|
key []byte // key will be used after key agreement
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewKeyExchange create one new KeyExchange object
|
// NewKeyExchange create one new KeyExchange object
|
||||||
@ -523,7 +525,7 @@ func NewKeyExchange(priv *EncryptPrivateKey, uid, peerUID []byte, keyLen int, ge
|
|||||||
return ke
|
return ke
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetKey return key after key alignment
|
// GetKey return key after key agreement
|
||||||
func (ke *KeyExchange) GetKey() []byte {
|
func (ke *KeyExchange) GetKey() []byte {
|
||||||
return ke.key
|
return ke.key
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user