Documentation ¶
Index ¶
- Variables
- type DSA
- func FromBase64String(data string) DSA
- func FromBytes(data []byte) DSA
- func FromHexString(data string) DSA
- func FromPKCS8PrivateKey(key []byte) DSA
- func FromPKCS8PrivateKeyWithPassword(key []byte, password string) DSA
- func FromPKCS8PublicKey(key []byte) DSA
- func FromPrivateKey(key []byte) DSA
- func FromPrivateKeyWithPassword(key []byte, password string) DSA
- func FromPublicKey(key []byte) DSA
- func FromString(data string) DSA
- func GenerateKey(ln string) DSA
- func New() DSA
- func NewDSA() DSA
- func (this DSA) AppendError(err ...error) DSA
- func (this DSA) CheckKeyPair() bool
- func (this DSA) CreatePKCS8PrivateKey() DSA
- func (this DSA) CreatePKCS8PrivateKeyWithPassword(password string, opts ...any) DSA
- func (this DSA) CreatePKCS8PublicKey() DSA
- func (this DSA) CreatePrivateKey() DSA
- func (this DSA) CreatePrivateKeyWithPassword(password string, opts ...string) DSA
- func (this DSA) CreatePublicKey() DSA
- func (this DSA) DataHash(signHash string, data []byte) ([]byte, error)
- func (this DSA) Error() error
- func (this DSA) FromBase64String(data string) DSA
- func (this DSA) FromBytes(data []byte) DSA
- func (this DSA) FromHexString(data string) DSA
- func (this DSA) FromPKCS8PrivateKey(key []byte) DSA
- func (this DSA) FromPKCS8PrivateKeyWithPassword(key []byte, password string) DSA
- func (this DSA) FromPKCS8PublicKey(key []byte) DSA
- func (this DSA) FromPrivateKey(key []byte) DSA
- func (this DSA) FromPrivateKeyWithPassword(key []byte, password string) DSA
- func (this DSA) FromPublicKey(key []byte) DSA
- func (this DSA) FromString(data string) DSA
- func (this DSA) GenerateKey(ln string) DSA
- func (this DSA) GetData() []byte
- func (this DSA) GetErrors() []error
- func (this DSA) GetKeyData() []byte
- func (this DSA) GetParedData() []byte
- func (this DSA) GetPrivateKey() *dsa.PrivateKey
- func (this DSA) GetPublicKey() *dsa.PublicKey
- func (this DSA) GetSignHash() string
- func (this DSA) GetVerify() bool
- func (this DSA) MakeKeyDer() DSA
- func (this DSA) MakePublicKey() DSA
- func (this DSA) OnError(fn DSAErrorFunc) DSA
- func (this DSA) ParsePKCS8PrivateKeyFromPEM(key []byte) (*dsa.PrivateKey, error)
- func (this DSA) ParsePKCS8PrivateKeyFromPEMWithPassword(key []byte, password string) (*dsa.PrivateKey, error)
- func (this DSA) ParsePKCS8PublicKeyFromPEM(key []byte) (*dsa.PublicKey, error)
- func (this DSA) ParsePrivateKeyFromPEM(key []byte) (*dsa.PrivateKey, error)
- func (this DSA) ParsePrivateKeyFromPEMWithPassword(key []byte, password string) (*dsa.PrivateKey, error)
- func (this DSA) ParsePublicKeyFromPEM(key []byte) (*dsa.PublicKey, error)
- func (this DSA) Sign(separator ...string) DSA
- func (this DSA) SignAsn1() DSA
- func (this DSA) SignBytes() DSA
- func (this DSA) SignHex() DSA
- func (this DSA) ToBase64String() string
- func (this DSA) ToBytes() []byte
- func (this DSA) ToHexString() string
- func (this DSA) ToKeyBytes() []byte
- func (this DSA) ToKeyString() string
- func (this DSA) ToString() string
- func (this DSA) ToVerify() bool
- func (this DSA) ToVerifyInt() int
- func (this DSA) Verify(data []byte, separator ...string) DSA
- func (this DSA) VerifyAsn1(data []byte) DSA
- func (this DSA) VerifyBytes(data []byte) DSA
- func (this DSA) VerifyHex(data []byte) DSA
- func (this DSA) WithData(data []byte) DSA
- func (this DSA) WithErrors(errs []error) DSA
- func (this DSA) WithParedData(data []byte) DSA
- func (this DSA) WithPrivateKey(data *dsa.PrivateKey) DSA
- func (this DSA) WithPublicKey(data *dsa.PublicKey) DSA
- func (this DSA) WithSignHash(data string) DSA
- func (this DSA) WithVerify(data bool) DSA
- type DSAErrorFunc
- type DSASignature
- type Opts
- type PBKDF2Opts
- type ScryptOpts
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // 获取 Cipher 类型 GetCipherFromName = cryptobin_pkcs8.GetCipherFromName // 获取 hash 类型 GetHashFromName = cryptobin_pkcs8.GetHashFromName )
View Source
var ( ErrKeyMustBePEMEncoded = errors.New("invalid key: Key must be a PEM encoded PKCS1 or PKCS8 key") ErrNotDSAPrivateKey = errors.New("key is not a valid DSA private key") ErrNotDSAPublicKey = errors.New("key is not a valid DSA public key") )
View Source
var PEMCiphers = map[string]x509.PEMCipher{ "DESCBC": x509.PEMCipherDES, "DESEDE3CBC": x509.PEMCipher3DES, "AES128CBC": x509.PEMCipherAES128, "AES192CBC": x509.PEMCipherAES192, "AES256CBC": x509.PEMCipherAES256, }
pem 加密方式
Functions ¶
This section is empty.
Types ¶
type DSA ¶
type DSA struct { // 错误 Errors []error // contains filtered or unexported fields }
*
- DSA *
- @create 2022-7-25
- @author deatil
func FromPKCS8PrivateKeyWithPassword ¶ added in v1.0.1018
PKCS8 私钥带密码
func FromPrivateKeyWithPassword ¶ added in v1.0.1018
私钥带密码
func GenerateKey ¶ added in v1.0.1018
生成密钥 可用参数 [L1024N160 | L2048N224 | L2048N256 | L3072N256]
func (DSA) CreatePKCS8PrivateKeyWithPassword ¶
生成 PKCS8 私钥带密码 pem 数据 CreatePKCS8PrivateKeyWithPassword("123", "AES256CBC", "SHA256")
func (DSA) CreatePrivateKey ¶
生成私钥 pem 数据 使用: dsa := New().GenerateKey("L2048N256") priKey := dsa.CreatePrivateKey().ToKeyString()
func (DSA) CreatePrivateKeyWithPassword ¶
生成私钥带密码 pem 数据 CreatePrivateKeyWithPassword("123", "AES256CBC")
func (DSA) FromPKCS8PrivateKeyWithPassword ¶
PKCS8 私钥带密码
func (DSA) FromPrivateKeyWithPassword ¶
私钥带密码
func (DSA) GenerateKey ¶
生成密钥 可用参数 [L1024N160 | L2048N224 | L2048N256 | L3072N256]
func (DSA) ParsePKCS8PrivateKeyFromPEM ¶
func (this DSA) ParsePKCS8PrivateKeyFromPEM(key []byte) (*dsa.PrivateKey, error)
解析私钥 PKCS8
func (DSA) ParsePKCS8PrivateKeyFromPEMWithPassword ¶
func (this DSA) ParsePKCS8PrivateKeyFromPEMWithPassword(key []byte, password string) (*dsa.PrivateKey, error)
解析 PKCS8 带密码的私钥
func (DSA) ParsePKCS8PublicKeyFromPEM ¶
解析公钥 PKCS8
func (DSA) ParsePrivateKeyFromPEM ¶
func (this DSA) ParsePrivateKeyFromPEM(key []byte) (*dsa.PrivateKey, error)
解析私钥
func (DSA) ParsePrivateKeyFromPEMWithPassword ¶
func (this DSA) ParsePrivateKeyFromPEMWithPassword(key []byte, password string) (*dsa.PrivateKey, error)
解析私钥带密码
func (DSA) ParsePublicKeyFromPEM ¶
解析公钥
func (DSA) WithSignHash ¶
设置 hash 类型 可用参数可查看 Hash 结构体数据
type DSASignature ¶
Click to show internal directories.
Click to hide internal directories.