dsa

package
v1.0.4008 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 18, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// 获取 Cipher 类型
	GetCipherFromName = pkcs8.GetCipherFromName
	// 获取 hash 类型
	GetHashFromName = 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")
)

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 FromBase64String added in v1.0.1018

func FromBase64String(data string) DSA

Base64

func FromBytes added in v1.0.1018

func FromBytes(data []byte) DSA

字节

func FromHexString added in v1.0.1018

func FromHexString(data string) DSA

Hex

func FromPKCS1PrivateKey added in v1.0.2015

func FromPKCS1PrivateKey(key []byte) DSA

PKCS1 私钥

func FromPKCS1PrivateKeyWithPassword added in v1.0.2015

func FromPKCS1PrivateKeyWithPassword(key []byte, password string) DSA

PKCS1 私钥带密码

func FromPKCS1PublicKey added in v1.0.2015

func FromPKCS1PublicKey(key []byte) DSA

PKCS1 公钥

func FromPKCS8PrivateKey added in v1.0.1018

func FromPKCS8PrivateKey(key []byte) DSA

PKCS8 私钥

func FromPKCS8PrivateKeyWithPassword added in v1.0.1018

func FromPKCS8PrivateKeyWithPassword(key []byte, password string) DSA

PKCS8 私钥带密码

func FromPKCS8PublicKey added in v1.0.1018

func FromPKCS8PublicKey(key []byte) DSA

PKCS8 公钥

func FromPrivateKey added in v1.0.1018

func FromPrivateKey(key []byte) DSA

私钥

func FromPrivateKeyWithPassword added in v1.0.1018

func FromPrivateKeyWithPassword(key []byte, password string) DSA

私钥带密码

func FromPublicKey added in v1.0.1018

func FromPublicKey(key []byte) DSA

公钥

func FromString added in v1.0.1018

func FromString(data string) DSA

字符

func FromXMLPrivateKey added in v1.0.2015

func FromXMLPrivateKey(key []byte) DSA

XML 私钥

func FromXMLPublicKey added in v1.0.2015

func FromXMLPublicKey(key []byte) DSA

XML 公钥

func GenerateKey added in v1.0.1018

func GenerateKey(ln string) DSA

生成密钥 可用参数 [L1024N160 | L2048N224 | L2048N256 | L3072N256]

func GenerateKeyWithSeed added in v1.0.2026

func GenerateKeyWithSeed(paramReader, generateReader io.Reader, ln string) DSA

生成密钥 可用参数 [L1024N160 | L2048N224 | L2048N256 | L3072N256]

func New added in v1.0.1018

func New() DSA

构造函数

func NewDSA

func NewDSA() DSA

构造函数

func (DSA) AppendError added in v1.0.1026

func (this DSA) AppendError(err ...error) DSA

添加错误

func (DSA) CheckKeyPair added in v1.0.1043

func (this DSA) CheckKeyPair() bool

检测公钥私钥是否匹配

func (DSA) CreatePKCS1PrivateKey added in v1.0.2014

func (this DSA) CreatePKCS1PrivateKey() DSA

生成 pkcs1 私钥 pem 数据

func (DSA) CreatePKCS1PrivateKeyWithPassword added in v1.0.2014

func (this DSA) CreatePKCS1PrivateKeyWithPassword(password string, opts ...string) DSA

生成 pkcs1 私钥带密码 pem 数据 CreatePKCS1PrivateKeyWithPassword("123", "AES256CBC") PEMCipher: DESCBC | DESEDE3CBC | AES128CBC | AES192CBC | AES256CBC

func (DSA) CreatePKCS1PublicKey added in v1.0.2014

func (this DSA) CreatePKCS1PublicKey() DSA

生成 pkcs1 公钥 pem 数据

func (DSA) CreatePKCS8PrivateKey

func (this DSA) CreatePKCS8PrivateKey() DSA

生成 pkcs8 私钥 pem 数据

func (DSA) CreatePKCS8PrivateKeyWithPassword

func (this DSA) CreatePKCS8PrivateKeyWithPassword(password string, opts ...any) DSA

生成 PKCS8 私钥带密码 pem 数据 CreatePKCS8PrivateKeyWithPassword("123", "AES256CBC", "SHA256")

func (DSA) CreatePKCS8PublicKey

func (this DSA) CreatePKCS8PublicKey() DSA

生成公钥 pem 数据

func (DSA) CreatePrivateKey

func (this DSA) CreatePrivateKey() DSA

生成私钥 pem 数据 dsa := New().GenerateKey("L2048N256") priKey := dsa.CreatePrivateKey().ToKeyString()

func (DSA) CreatePrivateKeyWithPassword

func (this DSA) CreatePrivateKeyWithPassword(password string, opts ...string) DSA

生成私钥带密码 pem 数据 CreatePrivateKeyWithPassword("123", "AES256CBC") PEMCipher: DESCBC | DESEDE3CBC | AES128CBC | AES192CBC | AES256CBC

func (DSA) CreatePublicKey

func (this DSA) CreatePublicKey() DSA

生成公钥 pem 数据

func (DSA) CreateXMLPrivateKey added in v1.0.2015

func (this DSA) CreateXMLPrivateKey() DSA

生成私钥 xml 数据

func (DSA) CreateXMLPublicKey added in v1.0.2015

func (this DSA) CreateXMLPublicKey() DSA

生成公钥 xml 数据

func (DSA) Error

func (this DSA) Error() error

获取错误

func (DSA) FromBase64String

func (this DSA) FromBase64String(data string) DSA

Base64

func (DSA) FromBytes

func (this DSA) FromBytes(data []byte) DSA

字节

func (DSA) FromHexString

func (this DSA) FromHexString(data string) DSA

Hex

func (DSA) FromPKCS1PrivateKey added in v1.0.2014

func (this DSA) FromPKCS1PrivateKey(key []byte) DSA

PKCS1 私钥

func (DSA) FromPKCS1PrivateKeyDer added in v1.0.2015

func (this DSA) FromPKCS1PrivateKeyDer(der []byte) DSA

Pkcs1 DER 私钥

func (DSA) FromPKCS1PrivateKeyWithPassword added in v1.0.2014

func (this DSA) FromPKCS1PrivateKeyWithPassword(key []byte, password string) DSA

PKCS1 私钥带密码

func (DSA) FromPKCS1PublicKey added in v1.0.2014

func (this DSA) FromPKCS1PublicKey(key []byte) DSA

PKCS1 公钥

func (DSA) FromPKCS1PublicKeyDer added in v1.0.2015

func (this DSA) FromPKCS1PublicKeyDer(der []byte) DSA

PKCS1 DER 公钥

func (DSA) FromPKCS8PrivateKey

func (this DSA) FromPKCS8PrivateKey(key []byte) DSA

PKCS8 私钥

func (DSA) FromPKCS8PrivateKeyDer added in v1.0.2015

func (this DSA) FromPKCS8PrivateKeyDer(der []byte) DSA

Pkcs8 DER 私钥

func (DSA) FromPKCS8PrivateKeyWithPassword

func (this DSA) FromPKCS8PrivateKeyWithPassword(key []byte, password string) DSA

PKCS8 私钥带密码

func (DSA) FromPKCS8PublicKey

func (this DSA) FromPKCS8PublicKey(key []byte) DSA

PKCS8 公钥

func (DSA) FromPKCS8PublicKeyDer added in v1.0.2015

func (this DSA) FromPKCS8PublicKeyDer(der []byte) DSA

PKCS8 DER 公钥

func (DSA) FromPrivateKey

func (this DSA) FromPrivateKey(key []byte) DSA

私钥

func (DSA) FromPrivateKeyWithPassword

func (this DSA) FromPrivateKeyWithPassword(key []byte, password string) DSA

私钥带密码

func (DSA) FromPublicKey

func (this DSA) FromPublicKey(key []byte) DSA

公钥

func (DSA) FromString

func (this DSA) FromString(data string) DSA

字符

func (DSA) FromXMLPrivateKey added in v1.0.2015

func (this DSA) FromXMLPrivateKey(key []byte) DSA

XML 私钥

func (DSA) FromXMLPublicKey added in v1.0.2015

func (this DSA) FromXMLPublicKey(key []byte) DSA

XML 公钥

func (DSA) GenerateKey

func (this DSA) GenerateKey(ln string) DSA

生成密钥 可用参数 [L1024N160 | L2048N224 | L2048N256 | L3072N256]

func (DSA) GenerateKeyWithSeed added in v1.0.2026

func (this DSA) GenerateKeyWithSeed(paramReader, generateReader io.Reader, ln string) DSA

生成密钥 可用参数 [L1024N160 | L2048N224 | L2048N256 | L3072N256]

func (DSA) GetData

func (this DSA) GetData() []byte

获取 data

func (DSA) GetEncoding added in v1.0.3009

func (this DSA) GetEncoding() EncodingType

get Encoding type

func (DSA) GetErrors added in v1.0.1026

func (this DSA) GetErrors() []error

获取错误

func (DSA) GetKeyData

func (this DSA) GetKeyData() []byte

获取 keyData

func (DSA) GetParsedData added in v1.0.2049

func (this DSA) GetParsedData() []byte

获取 parsedData

func (DSA) GetPrivateKey

func (this DSA) GetPrivateKey() *dsa.PrivateKey

获取 PrivateKey

func (DSA) GetPublicKey

func (this DSA) GetPublicKey() *dsa.PublicKey

获取 PublicKey

func (DSA) GetSignHash

func (this DSA) GetSignHash() HashFunc

获取 hash 类型

func (DSA) GetVerify added in v1.0.1032

func (this DSA) GetVerify() bool

获取验证后情况

func (DSA) MakeKeyDer added in v1.0.1033

func (this DSA) MakeKeyDer() DSA

生成密钥 der 数据

func (DSA) MakePublicKey

func (this DSA) MakePublicKey() DSA

生成公钥

func (DSA) OnError

func (this DSA) OnError(fn DSAErrorFunc) DSA

引出错误信息

func (DSA) ParsePKCS1PrivateKeyFromPEM added in v1.0.2014

func (this DSA) ParsePKCS1PrivateKeyFromPEM(key []byte) (*dsa.PrivateKey, error)

解析私钥

func (DSA) ParsePKCS1PrivateKeyFromPEMWithPassword added in v1.0.2014

func (this DSA) ParsePKCS1PrivateKeyFromPEMWithPassword(key []byte, password string) (*dsa.PrivateKey, error)

解析私钥带密码

func (DSA) ParsePKCS1PublicKeyFromPEM added in v1.0.2014

func (this DSA) ParsePKCS1PublicKeyFromPEM(key []byte) (*dsa.PublicKey, error)

解析公钥

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

func (this DSA) ParsePKCS8PublicKeyFromPEM(key []byte) (*dsa.PublicKey, error)

解析公钥 PKCS8

func (DSA) ParsePrivateKeyFromXML added in v1.0.2015

func (this DSA) ParsePrivateKeyFromXML(key []byte) (*dsa.PrivateKey, error)

解析 xml 私钥

func (DSA) ParsePublicKeyFromXML added in v1.0.2015

func (this DSA) ParsePublicKeyFromXML(key []byte) (*dsa.PublicKey, error)

解析 xml 公钥

func (DSA) SetSignHash added in v1.0.2014

func (this DSA) SetSignHash(data string) DSA

设置 hash 类型 可用参数可查看 Hash 结构体数据

func (DSA) Sign

func (this DSA) Sign() DSA

私钥签名

func (DSA) SignASN1 added in v1.0.2039

func (this DSA) SignASN1() DSA

私钥签名

func (DSA) SignBytes

func (this DSA) SignBytes() DSA

私钥签名

func (DSA) SignWithSeparator added in v1.0.2050

func (this DSA) SignWithSeparator(separator ...string) DSA

私钥签名

func (DSA) ToBase64String

func (this DSA) ToBase64String() string

输出Base64

func (DSA) ToBytes

func (this DSA) ToBytes() []byte

输出字节

func (DSA) ToHexString

func (this DSA) ToHexString() string

输出Hex

func (DSA) ToKeyBytes

func (this DSA) ToKeyBytes() []byte

私钥/公钥

func (DSA) ToKeyString

func (this DSA) ToKeyString() string

私钥/公钥

func (DSA) ToString

func (this DSA) ToString() string

输出字符

func (DSA) ToVerify added in v1.0.1032

func (this DSA) ToVerify() bool

验证结果

func (DSA) ToVerifyInt added in v1.0.1033

func (this DSA) ToVerifyInt() int

验证结果,返回 int 类型

func (DSA) Verify added in v1.0.1033

func (this DSA) Verify(data []byte) DSA

公钥验证 使用原始数据[data]对比签名后数据

func (DSA) VerifyASN1 added in v1.0.2039

func (this DSA) VerifyASN1(data []byte) DSA

公钥验证 使用原始数据[data]对比签名后数据

func (DSA) VerifyBytes

func (this DSA) VerifyBytes(data []byte) DSA

公钥验证 使用原始数据[data]对比签名后数据

func (DSA) VerifyWithSeparator added in v1.0.2050

func (this DSA) VerifyWithSeparator(data []byte, separator ...string) DSA

公钥验证 使用原始数据[data]对比签名后数据

func (DSA) WithData

func (this DSA) WithData(data []byte) DSA

设置 data

func (DSA) WithEncoding added in v1.0.3009

func (this DSA) WithEncoding(encoding EncodingType) DSA

设置编码方式

func (DSA) WithEncodingASN1 added in v1.0.3009

func (this DSA) WithEncodingASN1() DSA

设置 ASN1 编码方式

func (DSA) WithEncodingBytes added in v1.0.3009

func (this DSA) WithEncodingBytes() DSA

设置明文编码方式

func (DSA) WithErrors added in v1.0.1026

func (this DSA) WithErrors(errs []error) DSA

设置错误

func (DSA) WithParsedData added in v1.0.2049

func (this DSA) WithParsedData(data []byte) DSA

设置 parsedData

func (DSA) WithPrivateKey

func (this DSA) WithPrivateKey(data *dsa.PrivateKey) DSA

设置 PrivateKey

func (DSA) WithPublicKey

func (this DSA) WithPublicKey(data *dsa.PublicKey) DSA

设置 PublicKey

func (DSA) WithSignHash

func (this DSA) WithSignHash(data HashFunc) DSA

设置 hash 类型

func (DSA) WithVerify added in v1.0.1032

func (this DSA) WithVerify(data bool) DSA

设置 verify

type DSAErrorFunc

type DSAErrorFunc = func([]error)

错误方法

type EncodingType added in v1.0.3009

type EncodingType uint

数据编码方式 marshal data type

const (
	EncodingASN1 EncodingType = 1 + iota
	EncodingBytes
)

type HashFunc added in v1.0.2014

type HashFunc = func() hash.Hash

HashFunc

type Opts added in v1.0.1018

type Opts = pkcs8.Opts

配置

type PBKDF2Opts added in v1.0.1018

type PBKDF2Opts = pkcs8.PBKDF2Opts

PBKDF2 配置

type ScryptOpts added in v1.0.1018

type ScryptOpts = pkcs8.ScryptOpts

Scrypt 配置

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL