dsa

package
v1.1.1013 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Get cipher from name
	GetCipherFromName = pkcs8.GetCipherFromName
	// Get hash from name
	GetHashFromName = pkcs8.GetHashFromName
)
View Source
var (
	ErrKeyMustBePEMEncoded = errors.New("go-cryptobin/dsa: invalid key: Key must be a PEM encoded PKCS1 or PKCS8 key")
	ErrNotDSAPrivateKey    = errors.New("go-cryptobin/dsa: key is not a valid DSA private key")
	ErrNotDSAPublicKey     = errors.New("go-cryptobin/dsa: key is not a valid DSA public key")
)

Functions

This section is empty.

Types

type DSA

type DSA struct {

	// error list
	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

From Base64 String

func FromBytes added in v1.0.1018

func FromBytes(data []byte) DSA

From Bytes

func FromHexString added in v1.0.1018

func FromHexString(data string) DSA

From Hex String

func FromPKCS1PrivateKey added in v1.0.2015

func FromPKCS1PrivateKey(key []byte) DSA

From PKCS1 PrivateKey bytes

func FromPKCS1PrivateKeyWithPassword added in v1.0.2015

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

From PKCS1 PrivateKey bytes With Password

func FromPKCS1PublicKey added in v1.0.2015

func FromPKCS1PublicKey(key []byte) DSA

From PKCS1 PublicKey bytes

func FromPKCS8PrivateKey added in v1.0.1018

func FromPKCS8PrivateKey(key []byte) DSA

From PKCS8 PrivateKey bytes

func FromPKCS8PrivateKeyWithPassword added in v1.0.1018

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

From PKCS8 PrivateKey bytes With Password

func FromPKCS8PublicKey added in v1.0.1018

func FromPKCS8PublicKey(key []byte) DSA

From PKCS8 PublicKey bytes

func FromPrivateKey added in v1.0.1018

func FromPrivateKey(key []byte) DSA

From PrivateKey bytes

func FromPrivateKeyWithPassword added in v1.0.1018

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

From PrivateKey bytes With Password

func FromPublicKey added in v1.0.1018

func FromPublicKey(key []byte) DSA

From PublicKey bytes

func FromString added in v1.0.1018

func FromString(data string) DSA

From String

func FromXMLPrivateKey added in v1.0.2015

func FromXMLPrivateKey(key []byte) DSA

From PrivateKey XML bytes

func FromXMLPublicKey added in v1.0.2015

func FromXMLPublicKey(key []byte) DSA

From PublicKey XML bytes

func GenerateKey added in v1.0.1018

func GenerateKey(ln string) DSA

GenerateKey params [L1024N160 | L2048N224 | L2048N256 | L3072N256]

func GenerateKeyWithSeed added in v1.0.2026

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

GenerateKey With Seed params [L1024N160 | L2048N224 | L2048N256 | L3072N256]

func New added in v1.0.1018

func New() DSA

New DSA

func NewDSA

func NewDSA() DSA

NewDSA

func (DSA) AppendError added in v1.0.1026

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

append error

func (DSA) CheckKeyPair added in v1.0.1043

func (this DSA) CheckKeyPair() bool

Check KeyPair

func (DSA) CreatePKCS1PrivateKey added in v1.0.2014

func (this DSA) CreatePKCS1PrivateKey() DSA

Create PKCS1 PrivateKey PEM data

func (DSA) CreatePKCS1PrivateKeyWithPassword added in v1.0.2014

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

Create PKCS1 PrivateKey PEM data with password CreatePKCS1PrivateKeyWithPassword("123", "AES256CBC") PEMCipher: DESCBC | DESEDE3CBC | AES128CBC | AES192CBC | AES256CBC

func (DSA) CreatePKCS1PublicKey added in v1.0.2014

func (this DSA) CreatePKCS1PublicKey() DSA

Create PKCS1 PublicKey PEM data

func (DSA) CreatePKCS8PrivateKey

func (this DSA) CreatePKCS8PrivateKey() DSA

Create PKCS8 PrivateKey PEM data

func (DSA) CreatePKCS8PrivateKeyWithPassword

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

Create PKCS8 PrivateKey PEM data with password CreatePKCS8PrivateKeyWithPassword("123", "AES256CBC", "SHA256")

func (DSA) CreatePKCS8PublicKey

func (this DSA) CreatePKCS8PublicKey() DSA

Create PKCS8 PublicKey PEM data

func (DSA) CreatePrivateKey

func (this DSA) CreatePrivateKey() DSA

Create PrivateKey PEM data dsa := New().GenerateKey("L2048N256") priKey := dsa.CreatePrivateKey().ToKeyString()

func (DSA) CreatePrivateKeyWithPassword

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

Create PrivateKey PEM data with password CreatePrivateKeyWithPassword("123", "AES256CBC") PEMCipher: DESCBC | DESEDE3CBC | AES128CBC | AES192CBC | AES256CBC

func (DSA) CreatePublicKey

func (this DSA) CreatePublicKey() DSA

Create PublicKey PEM data

func (DSA) CreateXMLPrivateKey added in v1.0.2015

func (this DSA) CreateXMLPrivateKey() DSA

Create PrivateKey XML data

func (DSA) CreateXMLPublicKey added in v1.0.2015

func (this DSA) CreateXMLPublicKey() DSA

Create PublicKey XML data

func (DSA) Error

func (this DSA) Error() error

return error

func (DSA) FromBase64String

func (this DSA) FromBase64String(data string) DSA

From Base64 String

func (DSA) FromBytes

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

From Bytes

func (DSA) FromHexString

func (this DSA) FromHexString(data string) DSA

From Hex String

func (DSA) FromPKCS1PrivateKey added in v1.0.2014

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

From PKCS1 PrivateKey bytes

func (DSA) FromPKCS1PrivateKeyDer added in v1.0.2015

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

From PKCS1 PrivateKey Der bytes

func (DSA) FromPKCS1PrivateKeyWithPassword added in v1.0.2014

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

From PKCS1 PrivateKey bytes With Password

func (DSA) FromPKCS1PublicKey added in v1.0.2014

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

From PKCS1 PublicKey bytes

func (DSA) FromPKCS1PublicKeyDer added in v1.0.2015

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

From PKCS1 PublicKey Der bytes

func (DSA) FromPKCS8PrivateKey

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

From PKCS8 PrivateKey bytes

func (DSA) FromPKCS8PrivateKeyDer added in v1.0.2015

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

From PKCS8 PrivateKey Der bytes

func (DSA) FromPKCS8PrivateKeyWithPassword

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

From PKCS8 PrivateKey bytes With Password

func (DSA) FromPKCS8PublicKey

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

From PKCS8 PublicKey bytes

func (DSA) FromPKCS8PublicKeyDer added in v1.0.2015

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

From PKCS8 PublicKey Der bytes

func (DSA) FromPrivateKey

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

From PrivateKey bytes

func (DSA) FromPrivateKeyWithPassword

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

From PrivateKey bytes With Password

func (DSA) FromPublicKey

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

From PublicKey bytes

func (DSA) FromString

func (this DSA) FromString(data string) DSA

From String

func (DSA) FromXMLPrivateKey added in v1.0.2015

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

From PrivateKey XML bytes

func (DSA) FromXMLPublicKey added in v1.0.2015

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

From PublicKey XML bytes

func (DSA) GenerateKey

func (this DSA) GenerateKey(ln string) DSA

GenerateKey params [L1024N160 | L2048N224 | L2048N256 | L3072N256]

func (DSA) GenerateKeyWithSeed added in v1.0.2026

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

GenerateKey With Seed params [L1024N160 | L2048N224 | L2048N256 | L3072N256]

func (DSA) GetData

func (this DSA) GetData() []byte

get 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

get error list

func (DSA) GetKeyData

func (this DSA) GetKeyData() []byte

get keyData

func (DSA) GetParsedData added in v1.0.2049

func (this DSA) GetParsedData() []byte

get parsed data

func (DSA) GetPrivateKey

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

get PrivateKey

func (DSA) GetPublicKey

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

get PublicKey

func (DSA) GetSignHash

func (this DSA) GetSignHash() HashFunc

get hash type

func (DSA) GetVerify added in v1.0.1032

func (this DSA) GetVerify() bool

get verify

func (DSA) MakeKeyDer added in v1.0.1033

func (this DSA) MakeKeyDer() DSA

Make Key Der data

func (DSA) MakePublicKey

func (this DSA) MakePublicKey() DSA

Make PublicKey

func (DSA) OnError

func (this DSA) OnError(fn func([]error)) DSA

func (DSA) ParsePKCS1PrivateKeyFromPEM added in v1.0.2014

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

Parse PKCS1 PrivateKey From PEM

func (DSA) ParsePKCS1PrivateKeyFromPEMWithPassword added in v1.0.2014

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

Parse PKCS1 PrivateKey From PEM With Password

func (DSA) ParsePKCS1PublicKeyFromPEM added in v1.0.2014

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

Parse PKCS1 PublicKey From PEM

func (DSA) ParsePKCS8PrivateKeyFromPEM

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

Parse PKCS8 PrivateKey From PEM

func (DSA) ParsePKCS8PrivateKeyFromPEMWithPassword

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

Parse PKCS8 PrivateKey From PEM With Password

func (DSA) ParsePKCS8PublicKeyFromPEM

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

Parse PKCS8 PublicKey From PEM

func (DSA) ParsePrivateKeyFromXML added in v1.0.2015

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

Parse PrivateKey From XML

func (DSA) ParsePublicKeyFromXML added in v1.0.2015

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

Parse PublicKey From XML

func (DSA) SetSignHash added in v1.0.2014

func (this DSA) SetSignHash(data string) DSA

Set hash type 可用参数可查看 Hash 结构体数据

func (DSA) Sign

func (this DSA) Sign() DSA

privateKey Sign

func (DSA) SignASN1 added in v1.0.2039

func (this DSA) SignASN1() DSA

privateKey Sign ASN1

func (DSA) SignBytes

func (this DSA) SignBytes() DSA

privateKey Sign Bytes

func (DSA) SignWithSeparator added in v1.0.2050

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

privateKey Sign With Separator

func (DSA) ToBase64String

func (this DSA) ToBase64String() string

output base64 data

func (DSA) ToBytes

func (this DSA) ToBytes() []byte

output bytes data

func (DSA) ToHexString

func (this DSA) ToHexString() string

output hex data

func (DSA) ToKeyBytes

func (this DSA) ToKeyBytes() []byte

output key bytes data

func (DSA) ToKeyString

func (this DSA) ToKeyString() string

output key string data

func (DSA) ToString

func (this DSA) ToString() string

output string data

func (DSA) ToVerify added in v1.0.1032

func (this DSA) ToVerify() bool

output verify data

func (DSA) ToVerifyInt added in v1.0.1033

func (this DSA) ToVerifyInt() int

output verify int data

func (DSA) Verify added in v1.0.1033

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

publicKey Verify 使用原始数据[data]对比签名后数据

func (DSA) VerifyASN1 added in v1.0.2039

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

publicKey Verify ASN1 使用原始数据[data]对比签名后数据

func (DSA) VerifyBytes

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

publicKey Verify Bytes 使用原始数据[data]对比签名后数据

func (DSA) VerifyWithSeparator added in v1.0.2050

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

publicKey Verify With Separator 使用原始数据[data]对比签名后数据

func (DSA) WithData

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

Set data

func (DSA) WithEncoding added in v1.0.3009

func (this DSA) WithEncoding(encoding EncodingType) DSA

Set encoding type

func (DSA) WithEncodingASN1 added in v1.0.3009

func (this DSA) WithEncodingASN1() DSA

Set ASN1 Encoding

func (DSA) WithEncodingBytes added in v1.0.3009

func (this DSA) WithEncodingBytes() DSA

Set Plain Encoding

func (DSA) WithErrors added in v1.0.1026

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

Set error list

func (DSA) WithParsedData added in v1.0.2049

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

Set parsedData

func (DSA) WithPrivateKey

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

Set PrivateKey

func (DSA) WithPublicKey

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

Set PublicKey

func (DSA) WithSignHash

func (this DSA) WithSignHash(data HashFunc) DSA

Set hash type

func (DSA) WithVerify added in v1.0.1032

func (this DSA) WithVerify(data bool) DSA

Set verify

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

Options

type PBKDF2Opts added in v1.0.1018

type PBKDF2Opts = pkcs8.PBKDF2Opts

PBKDF2 Options

type ScryptOpts added in v1.0.1018

type ScryptOpts = pkcs8.ScryptOpts

Scrypt Options

Jump to

Keyboard shortcuts

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