init: v1.0.0

This commit is contained in:
yaole
2026-05-27 23:03:00 +08:00
commit 8d97f750eb
466 changed files with 80067 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
package sm2
import (
"testing"
"github.com/stretchr/testify/assert"
"xdx.jelly/xgcl/grand"
)
// Test Cipher
func TestCipherP7(t *testing.T) {
sk, _ := GenerateKey(Curve(), grand.Reader)
data := make([]byte, 48)
cipher, _ := Encrypt(&sk.PublicKey, data, grand.GetRandom(32))
b, err := cipher.MarshalASN1()
assert.Nil(t, err)
var cipher2 Cipher
b, err = cipher2.UnmarshalASN1(b)
assert.Equal(t, len(b), 0)
assert.Nil(t, err)
assert.Equal(t, cipher.String(), cipher2.String())
}