Documentation ¶
Index ¶
- Constants
- func ECDSAPrivateKeyToPEM(key *ECDSAPrivateKey) ([]byte, error)
- func ECDSAPublicKeyToPEM(key *ECDSAPublicKey) ([]byte, error)
- func GetCurveHalfOrderAt(curve elliptic.Curve) *big.Int
- func IsLowS(key *ecdsa.PublicKey, s *big.Int) (bool, error)
- func MarshalECDSASignature(r, s *big.Int) ([]byte, error)
- func NewECDSAPrivateKey(sk *ecdsa.PrivateKey) csp.Key
- func NewECDSAPublicKey(pk *ecdsa.PublicKey) csp.Key
- func SignatureToLowS(key *ecdsa.PublicKey, signature []byte) ([]byte, error)
- func ToLowS(key *ecdsa.PublicKey, s *big.Int) (*big.Int, error)
- func UnmarshalECDSASignature(raw []byte) (r, s *big.Int, err error)
- type ECDSAGoPublicKeyImportOpts
- type ECDSAGoPublicKeyImporter
- type ECDSAKeyGenerator
- type ECDSAP256KeyGenOpts
- type ECDSAP384KeyGenOpts
- type ECDSAPKIXPublicKeyImportOpts
- type ECDSAPKIXPublicKeyImporter
- type ECDSAPrivateKey
- type ECDSAPrivateKeyDeriver
- type ECDSAPrivateKeyImportOpts
- type ECDSAPrivateKeyImporter
- type ECDSAPrivateKeyVerifier
- type ECDSAPublicKey
- type ECDSAPublicKeyDeriver
- type ECDSAPublicKeyVerifier
- type ECDSAReRandKeyOpts
- type ECDSASignature
- type ECDSASigner
- type ECDSAX509PublicKeyImportOpts
- type ECDSAX509PublicKeyImporter
Constants ¶
const ( ECDSA = "ECDSA" ECDSAP256 = "ECDSAP256" ECDSAP384 = "ECDSAP384" ECDSAReRand = "ECDSA_RERAND" )
Variables ¶
This section is empty.
Functions ¶
func ECDSAPrivateKeyToPEM ¶
func ECDSAPrivateKeyToPEM(key *ECDSAPrivateKey) ([]byte, error)
func ECDSAPublicKeyToPEM ¶
func ECDSAPublicKeyToPEM(key *ECDSAPublicKey) ([]byte, error)
func NewECDSAPrivateKey ¶
func NewECDSAPrivateKey(sk *ecdsa.PrivateKey) csp.Key
Types ¶
type ECDSAGoPublicKeyImportOpts ¶
type ECDSAGoPublicKeyImportOpts struct {
Temporary bool
}
func (*ECDSAGoPublicKeyImportOpts) Algorithm ¶
func (opts *ECDSAGoPublicKeyImportOpts) Algorithm() string
func (*ECDSAGoPublicKeyImportOpts) Ephemeral ¶
func (opts *ECDSAGoPublicKeyImportOpts) Ephemeral() bool
type ECDSAGoPublicKeyImporter ¶
type ECDSAGoPublicKeyImporter struct{}
func NewECDSAGoPublicKeyImporter ¶
func NewECDSAGoPublicKeyImporter() *ECDSAGoPublicKeyImporter
func (*ECDSAGoPublicKeyImporter) KeyImport ¶
func (*ECDSAGoPublicKeyImporter) KeyImport(raw interface{}, opts csp.KeyImportOpts) (csp.Key, error)
KeyImport 此方法的第一个参数必须是 *ecdsa.PublicKey,第二个参数 KeyImportOpts 可以是 nil。
type ECDSAKeyGenerator ¶
type ECDSAKeyGenerator struct {
// contains filtered or unexported fields
}
func NewECDSAKeyGenerator ¶
func NewECDSAKeyGenerator(curve elliptic.Curve) *ECDSAKeyGenerator
func (*ECDSAKeyGenerator) KeyGen ¶
func (kg *ECDSAKeyGenerator) KeyGen(opts csp.KeyGenOpts) (csp.Key, error)
KeyGen 方法不需要传入 KeyGenOpts 参数。
type ECDSAP256KeyGenOpts ¶
type ECDSAP256KeyGenOpts struct {
Temporary bool
}
func (*ECDSAP256KeyGenOpts) Algorithm ¶
func (opts *ECDSAP256KeyGenOpts) Algorithm() string
func (*ECDSAP256KeyGenOpts) Ephemeral ¶
func (opts *ECDSAP256KeyGenOpts) Ephemeral() bool
Ephemeral 如果此方法在调用时返回 true,则生成的 ECDSA 密钥不会存储到文件中。
type ECDSAP384KeyGenOpts ¶
type ECDSAP384KeyGenOpts struct {
Temporary bool
}
func (*ECDSAP384KeyGenOpts) Algorithm ¶
func (opts *ECDSAP384KeyGenOpts) Algorithm() string
func (*ECDSAP384KeyGenOpts) Ephemeral ¶
func (opts *ECDSAP384KeyGenOpts) Ephemeral() bool
Ephemeral 如果此方法在调用时返回 true,则生成的 ECDSA 密钥不会存储到文件中。
type ECDSAPKIXPublicKeyImportOpts ¶
type ECDSAPKIXPublicKeyImportOpts struct {
Temporary bool
}
func (*ECDSAPKIXPublicKeyImportOpts) Algorithm ¶
func (opts *ECDSAPKIXPublicKeyImportOpts) Algorithm() string
func (*ECDSAPKIXPublicKeyImportOpts) Ephemeral ¶
func (opts *ECDSAPKIXPublicKeyImportOpts) Ephemeral() bool
type ECDSAPKIXPublicKeyImporter ¶
type ECDSAPKIXPublicKeyImporter struct{}
func NewECDSAPKIXPublicKeyImporter ¶
func NewECDSAPKIXPublicKeyImporter() *ECDSAPKIXPublicKeyImporter
func (*ECDSAPKIXPublicKeyImporter) KeyImport ¶
func (*ECDSAPKIXPublicKeyImporter) KeyImport(raw interface{}, opts csp.KeyImportOpts) (csp.Key, error)
KeyImport 次方的第一个参数必须是 ECDSA 公钥的 PKIX, ASN.1 DER 格式,第二个参数 KeyImportOpts 可以是 nil。
type ECDSAPrivateKey ¶
type ECDSAPrivateKey struct {
// contains filtered or unexported fields
}
func (*ECDSAPrivateKey) Bytes ¶
func (key *ECDSAPrivateKey) Bytes() ([]byte, error)
func (*ECDSAPrivateKey) Private ¶
func (key *ECDSAPrivateKey) Private() bool
func (*ECDSAPrivateKey) PublicKey ¶
func (key *ECDSAPrivateKey) PublicKey() (publicKey csp.Key, err error)
func (*ECDSAPrivateKey) SKI ¶
func (key *ECDSAPrivateKey) SKI() []byte
func (*ECDSAPrivateKey) Symmetric ¶
func (key *ECDSAPrivateKey) Symmetric() bool
type ECDSAPrivateKeyDeriver ¶
type ECDSAPrivateKeyDeriver struct{}
func NewECDSAPrivateKeyDeriver ¶
func NewECDSAPrivateKeyDeriver() *ECDSAPrivateKeyDeriver
func (*ECDSAPrivateKeyDeriver) KeyDeriv ¶
func (kd *ECDSAPrivateKeyDeriver) KeyDeriv(key csp.Key, opts csp.KeyDerivOpts) (csp.Key, error)
KeyDeriv 此方法的第二个参数必须是 *ECDSAReRandKeyOpts 实例。
type ECDSAPrivateKeyImportOpts ¶
type ECDSAPrivateKeyImportOpts struct {
Temporary bool
}
func (*ECDSAPrivateKeyImportOpts) Algorithm ¶
func (opts *ECDSAPrivateKeyImportOpts) Algorithm() string
func (*ECDSAPrivateKeyImportOpts) Ephemeral ¶
func (opts *ECDSAPrivateKeyImportOpts) Ephemeral() bool
type ECDSAPrivateKeyImporter ¶
type ECDSAPrivateKeyImporter struct{}
func NewECDSAPrivateKeyImporter ¶
func NewECDSAPrivateKeyImporter() *ECDSAPrivateKeyImporter
func (*ECDSAPrivateKeyImporter) KeyImport ¶
func (*ECDSAPrivateKeyImporter) KeyImport(raw interface{}, opts csp.KeyImportOpts) (csp.Key, error)
KeyImport 此方法的第一个参数必须是 ECDSA 私钥的 SEC 1, ASN.1 DER 格式,第二个参数 KeyImportOpts 可以是 nil。
type ECDSAPrivateKeyVerifier ¶
type ECDSAPrivateKeyVerifier struct{}
func NewECDSAPrivateKeyVerifier ¶
func NewECDSAPrivateKeyVerifier() *ECDSAPrivateKeyVerifier
func (*ECDSAPrivateKeyVerifier) Verify ¶
func (verifier *ECDSAPrivateKeyVerifier) Verify(key csp.Key, signature, digest []byte, opts csp.SignerOpts) (bool, error)
Verify 此方法传入的第一个参数必须是 *ECDSAPrivateKey,第四个参数 SignerOpts 可以是 nil。
type ECDSAPublicKey ¶
type ECDSAPublicKey struct {
// contains filtered or unexported fields
}
func (*ECDSAPublicKey) Bytes ¶
func (key *ECDSAPublicKey) Bytes() ([]byte, error)
func (*ECDSAPublicKey) Private ¶
func (key *ECDSAPublicKey) Private() bool
func (*ECDSAPublicKey) PublicKey ¶
func (key *ECDSAPublicKey) PublicKey() (publicKey csp.Key, err error)
func (*ECDSAPublicKey) SKI ¶
func (key *ECDSAPublicKey) SKI() []byte
func (*ECDSAPublicKey) Symmetric ¶
func (key *ECDSAPublicKey) Symmetric() bool
type ECDSAPublicKeyDeriver ¶
type ECDSAPublicKeyDeriver struct{}
func NewECDSAPublicKeyDeriver ¶
func NewECDSAPublicKeyDeriver() *ECDSAPublicKeyDeriver
func (*ECDSAPublicKeyDeriver) KeyDeriv ¶
func (kd *ECDSAPublicKeyDeriver) KeyDeriv(key csp.Key, opts csp.KeyDerivOpts) (csp.Key, error)
KeyDeriv 此方法的第二个参数必须是 *ECDSAReRandKeyOpts 实例。
type ECDSAPublicKeyVerifier ¶
type ECDSAPublicKeyVerifier struct{}
func NewECDSAPublicKeyVerifier ¶
func NewECDSAPublicKeyVerifier() *ECDSAPublicKeyVerifier
func (*ECDSAPublicKeyVerifier) Verify ¶
func (verifier *ECDSAPublicKeyVerifier) Verify(key csp.Key, signature, digest []byte, opts csp.SignerOpts) (bool, error)
Verify 此方法传入的第一个参数必须是 *ECDSAPublicKey,第四个参数 SignerOpts 可以是 nil。
type ECDSAReRandKeyOpts ¶
func (*ECDSAReRandKeyOpts) Algorithm ¶
func (opts *ECDSAReRandKeyOpts) Algorithm() string
func (*ECDSAReRandKeyOpts) Ephemeral ¶
func (opts *ECDSAReRandKeyOpts) Ephemeral() bool
type ECDSASignature ¶
type ECDSASigner ¶
type ECDSASigner struct{}
func NewECDSASigner ¶
func NewECDSASigner() *ECDSASigner
func (*ECDSASigner) Sign ¶
func (signer *ECDSASigner) Sign(key csp.Key, digest []byte, opts csp.SignerOpts) ([]byte, error)
Sign 此方法传入的第一个参数必须是 *ECDSAPrivateKey,第三个参数 SignerOpts 可以是 nil。
type ECDSAX509PublicKeyImportOpts ¶
type ECDSAX509PublicKeyImportOpts struct {
Temporary bool
}
func (*ECDSAX509PublicKeyImportOpts) Algorithm ¶
func (opts *ECDSAX509PublicKeyImportOpts) Algorithm() string
func (*ECDSAX509PublicKeyImportOpts) Ephemeral ¶
func (opts *ECDSAX509PublicKeyImportOpts) Ephemeral() bool
type ECDSAX509PublicKeyImporter ¶
type ECDSAX509PublicKeyImporter struct {
// contains filtered or unexported fields
}
func NewECDSAX509PublicKeyImporter ¶
func NewECDSAX509PublicKeyImporter(csp *softimpl.SoftCSPImpl) *ECDSAX509PublicKeyImporter
func (*ECDSAX509PublicKeyImporter) KeyImport ¶
func (importer *ECDSAX509PublicKeyImporter) KeyImport(raw interface{}, opts csp.KeyImportOpts) (csp.Key, error)
KeyImport 此方法的第一个参数必须是 *x509.Certificate,第二个参数 KeyImportOpts 可以是 nil。