Documentation ¶
Index ¶
- Variables
- type Bign
- func FromBase64String(data string) Bign
- func FromBytes(data []byte) Bign
- func FromHexString(data string) Bign
- func FromPKCS1PrivateKey(key []byte) Bign
- func FromPKCS1PrivateKeyWithPassword(key []byte, password string) Bign
- func FromPKCS8PrivateKey(key []byte) Bign
- func FromPKCS8PrivateKeyWithPassword(key []byte, password string) Bign
- func FromPrivateKey(key []byte) Bign
- func FromPrivateKeyWithPassword(key []byte, password string) Bign
- func FromPublicKey(key []byte) Bign
- func FromString(data string) Bign
- func GenerateKey(curve string) Bign
- func GenerateKeyWithSeed(reader io.Reader, curve string) Bign
- func New() Bign
- func NewBign() Bign
- func (this Bign) AppendError(err ...error) Bign
- func (this Bign) CheckKeyPair() bool
- func (this Bign) CreatePKCS1PrivateKey() Bign
- func (this Bign) CreatePKCS1PrivateKeyWithPassword(password string, opts ...string) Bign
- func (this Bign) CreatePKCS8PrivateKey() Bign
- func (this Bign) CreatePKCS8PrivateKeyWithPassword(password string, opts ...any) Bign
- func (this Bign) CreatePrivateKey() Bign
- func (this Bign) CreatePrivateKeyWithPassword(password string, opts ...string) Bign
- func (this Bign) CreatePublicKey() Bign
- func (this Bign) Error() error
- func (this Bign) FromBase64String(data string) Bign
- func (this Bign) FromBytes(data []byte) Bign
- func (this Bign) FromHexString(data string) Bign
- func (this Bign) FromPKCS1PrivateKey(key []byte) Bign
- func (this Bign) FromPKCS1PrivateKeyDer(der []byte) Bign
- func (this Bign) FromPKCS1PrivateKeyWithPassword(key []byte, password string) Bign
- func (this Bign) FromPKCS8PrivateKey(key []byte) Bign
- func (this Bign) FromPKCS8PrivateKeyDer(der []byte) Bign
- func (this Bign) FromPKCS8PrivateKeyWithPassword(key []byte, password string) Bign
- func (this Bign) FromPrivateKey(key []byte) Bign
- func (this Bign) FromPrivateKeyBytes(priByte []byte) Bign
- func (this Bign) FromPrivateKeyString(keyString string) Bign
- func (this Bign) FromPrivateKeyWithPassword(key []byte, password string) Bign
- func (this Bign) FromPublicKey(key []byte) Bign
- func (this Bign) FromPublicKeyBytes(pub []byte) Bign
- func (this Bign) FromPublicKeyCompressString(key string) Bign
- func (this Bign) FromPublicKeyDer(der []byte) Bign
- func (this Bign) FromPublicKeyString(key string) Bign
- func (this Bign) FromPublicKeyUncompressString(key string) Bign
- func (this Bign) FromPublicKeyXYBytes(xBytes, yBytes []byte) Bign
- func (this Bign) FromPublicKeyXYString(xString string, yString string) Bign
- func (this Bign) FromString(data string) Bign
- func (this Bign) GenerateKey() Bign
- func (this Bign) GenerateKeyWithSeed(reader io.Reader) Bign
- func (this Bign) GetAdata() []byte
- func (this Bign) GetCurve() elliptic.Curve
- func (this Bign) GetData() []byte
- func (this Bign) GetEncoding() EncodingType
- func (this Bign) GetErrors() []error
- func (this Bign) GetKeyData() []byte
- func (this Bign) GetParsedData() []byte
- func (this Bign) GetPrivateKey() *bign.PrivateKey
- func (this Bign) GetPrivateKeyCurve() elliptic.Curve
- func (this Bign) GetPrivateKeyDString() string
- func (this Bign) GetPrivateKeyString() string
- func (this Bign) GetPublicKey() *bign.PublicKey
- func (this Bign) GetPublicKeyCompressString() string
- func (this Bign) GetPublicKeyCurve() elliptic.Curve
- func (this Bign) GetPublicKeyUncompressString() string
- func (this Bign) GetPublicKeyXString() string
- func (this Bign) GetPublicKeyXYString() string
- func (this Bign) GetPublicKeyYString() string
- func (this Bign) GetSignHash() HashFunc
- func (this Bign) GetVerify() bool
- func (this Bign) MakeKeyDer() Bign
- func (this Bign) MakePublicKey() Bign
- func (this Bign) OnError(fn EcgdsaErrorFunc) Bign
- func (this Bign) ParsePKCS1PrivateKeyFromPEM(key []byte) (*bign.PrivateKey, error)
- func (this Bign) ParsePKCS1PrivateKeyFromPEMWithPassword(key []byte, password string) (*bign.PrivateKey, error)
- func (this Bign) ParsePKCS8PrivateKeyFromPEM(key []byte) (*bign.PrivateKey, error)
- func (this Bign) ParsePKCS8PrivateKeyFromPEMWithPassword(key []byte, password string) (*bign.PrivateKey, error)
- func (this Bign) ParsePublicKeyFromPEM(key []byte) (*bign.PublicKey, error)
- func (this Bign) SetCurve(curve string) Bign
- func (this Bign) SetSignHash(hash string) Bign
- func (this Bign) Sign() Bign
- func (this Bign) SignASN1() Bign
- func (this Bign) SignBytes() Bign
- func (this Bign) ToBase64String() string
- func (this Bign) ToBytes() []byte
- func (this Bign) ToHexString() string
- func (this Bign) ToKeyBytes() []byte
- func (this Bign) ToKeyString() string
- func (this Bign) ToString() string
- func (this Bign) ToVerify() bool
- func (this Bign) ToVerifyInt() int
- func (this Bign) Verify(data []byte) Bign
- func (this Bign) VerifyASN1(data []byte) Bign
- func (this Bign) VerifyBytes(data []byte) Bign
- func (this Bign) WithAdata(adata []byte) Bign
- func (this Bign) WithCurve(curve elliptic.Curve) Bign
- func (this Bign) WithData(data []byte) Bign
- func (this Bign) WithEncoding(encoding EncodingType) Bign
- func (this Bign) WithEncodingASN1() Bign
- func (this Bign) WithEncodingBytes() Bign
- func (this Bign) WithErrors(errs []error) Bign
- func (this Bign) WithParsedData(data []byte) Bign
- func (this Bign) WithPrivateKey(data *bign.PrivateKey) Bign
- func (this Bign) WithPublicKey(data *bign.PublicKey) Bign
- func (this Bign) WithSignHash(hash HashFunc) Bign
- func (this Bign) WithVerify(data bool) Bign
- type EcgdsaErrorFunc
- type EncodingType
- type HashFunc
- type Opts
- type PBKDF2Opts
- type ScryptOpts
Constants ¶
This section is empty.
Variables ¶
var ( // 获取 Cipher 类型 GetCipherFromName = pkcs8.GetCipherFromName // 获取 hash 类型 GetHashFromName = pkcs8.GetHashFromName )
var ( ErrKeyMustBePEMEncoded = errors.New("invalid key: Key must be a PEM encoded PKCS1 or PKCS8 key") ErrNotECPublicKey = errors.New("key is not a valid Bign public key") )
Functions ¶
This section is empty.
Types ¶
type Bign ¶
type Bign struct { // 错误 Errors []error // contains filtered or unexported fields }
*
- Bign *
- @create 2024-10-29
- @author deatil
func FromPKCS1PrivateKeyWithPassword ¶
私钥带密码
func FromPKCS8PrivateKeyWithPassword ¶
PKCS8 私钥带密码
func FromPrivateKeyWithPassword ¶
私钥
func GenerateKeyWithSeed ¶
生成密钥 可选 [Bign256v1 | Bign384v1 | Bign512v1]
func (Bign) CreatePKCS1PrivateKeyWithPassword ¶
生成私钥带密码 pem 数据
func (Bign) CreatePKCS8PrivateKey ¶
生成 PKCS8 私钥 pem 数据
func (Bign) CreatePKCS8PrivateKeyWithPassword ¶
生成 PKCS8 私钥带密码 pem 数据 CreatePKCS8PrivateKeyWithPassword("123", "AES256CBC", "SHA256")
func (Bign) CreatePrivateKey ¶
生成私钥 pem 数据, PKCS1 别名 使用: gen := GenerateKey("P521") priKey := gen.CreatePrivateKey().ToKeyString()
func (Bign) CreatePrivateKeyWithPassword ¶
生成私钥带密码 pem 数据, PKCS1 别名 CreatePrivateKeyWithPassword("123", "AES256CBC") PEMCipher: DESCBC | DESEDE3CBC | AES128CBC | AES192CBC | AES256CBC
func (Bign) FromPKCS1PrivateKeyDer ¶
DER 私钥
func (Bign) FromPKCS1PrivateKeyWithPassword ¶
私钥带密码
func (Bign) FromPKCS8PrivateKeyDer ¶
DER 私钥
func (Bign) FromPKCS8PrivateKeyWithPassword ¶
Pkcs8WithPassword
func (Bign) FromPrivateKeyBytes ¶
明文私钥生成私钥结构体 需要设置对应的 curve
func (Bign) FromPrivateKeyString ¶
私钥明文,需要设置对应的 curve private-key: 07e4********;
func (Bign) FromPrivateKeyWithPassword ¶
私钥带密码
func (Bign) FromPublicKeyBytes ¶
公钥明文, hex 或者 base64 解码后 需要设置对应的 curve
func (Bign) FromPublicKeyCompressString ¶
公钥明文压缩 需要设置对应的 curve public-key hex: 027c******** || 036c********
func (Bign) FromPublicKeyString ¶
公钥明文,需要设置对应的 curve
func (Bign) FromPublicKeyUncompressString ¶
公钥明文未压缩 需要设置对应的 curve public-key hex: 047c********.
func (Bign) FromPublicKeyXYBytes ¶
公钥字符对,需要设置对应的 curve
func (Bign) FromPublicKeyXYString ¶
公钥 x,y 16进制字符对 需要设置对应的 curve [xString: xHexString, yString: yHexString]
func (Bign) GetPrivateKeyCurve ¶
get PrivateKey Curve
func (Bign) GetPrivateKeyDString ¶
get PrivateKey D hex string
func (Bign) GetPrivateKeyString ¶
get PrivateKey data hex string
func (Bign) GetPublicKeyCompressString ¶
get PublicKey Compress Hex string
func (Bign) GetPublicKeyCurve ¶
get PublicKey Curve
func (Bign) GetPublicKeyUncompressString ¶
get PublicKey Uncompress Hex string
func (Bign) GetPublicKeyXString ¶
get PublicKey X hex string
func (Bign) GetPublicKeyXYString ¶
get PublicKey X and Y Hex string
func (Bign) GetPublicKeyYString ¶
get PublicKey Y hex string
func (Bign) ParsePKCS1PrivateKeyFromPEM ¶
func (this Bign) ParsePKCS1PrivateKeyFromPEM(key []byte) (*bign.PrivateKey, error)
解析私钥
func (Bign) ParsePKCS1PrivateKeyFromPEMWithPassword ¶
func (this Bign) ParsePKCS1PrivateKeyFromPEMWithPassword(key []byte, password string) (*bign.PrivateKey, error)
解析私钥带密码
func (Bign) ParsePKCS8PrivateKeyFromPEM ¶
func (this Bign) ParsePKCS8PrivateKeyFromPEM(key []byte) (*bign.PrivateKey, error)
解析私钥
func (Bign) ParsePKCS8PrivateKeyFromPEMWithPassword ¶
func (this Bign) ParsePKCS8PrivateKeyFromPEMWithPassword(key []byte, password string) (*bign.PrivateKey, error)
解析 PKCS8 带密码的私钥
func (Bign) ParsePublicKeyFromPEM ¶
解析公钥
func (Bign) VerifyASN1 ¶
公钥验证 ASN1 使用原始数据[data]对比签名后数据
func (Bign) VerifyBytes ¶
公钥验证 Bytes 使用原始数据[data]对比签名后数据
func (Bign) WithPrivateKey ¶
func (this Bign) WithPrivateKey(data *bign.PrivateKey) Bign
设置 PrivateKey
type EncodingType ¶
type EncodingType uint
marshal data type
const ( EncodingASN1 EncodingType = 1 + iota EncodingBytes )