tencentcloudkms

package
v2.3.6 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

nolint

nolint

nolint

Index

Constants

View Source
const (
	MODE_DIGEST = "DIGEST"
	MODE_RAW    = "RAW"

	KEY_TYPE_SM2_SIGNATURE = "ASYMMETRIC_SIGN_VERIFY_SM2"

	ALGORITHM_TYPE_SM2_SIGNATURE = "SM2DSA"
)

Variables

This section is empty.

Functions

func CreateConnection

func CreateConnection(kmsConfig *KMSConfig) (*kms.Client, error)

func ExportPublicKeyFromKMS

func ExportPublicKeyFromKMS(isPublic bool, client *kms.Client, keyId string) (bccrypto.PublicKey, error)

func GenerateKeyPairFromKMS

func GenerateKeyPairFromKMS(isPublic bool, client *kms.Client, keyAlias, keyType string) (bccrypto.PrivateKey, error)

func IsValidASN1Sig

func IsValidASN1Sig(sig []byte) ([]byte, bool)

IsValidASN1Sig check if sig is asn1-encoded

func LoadPrivateKey

func LoadPrivateKey(client *kms.Client, skInfo []byte, public bool) (bccrypto.PrivateKey, error)

func NewPrivateKey

func NewPrivateKey(client *kms.Client, keyConfig *KMSPrivateKeyConfig, isPublic bool) (bccrypto.PrivateKey, error)

Types

type KMSConfig

type KMSConfig struct {
	SecretId      string
	SecretKey     string
	ServerAddress string
	ServerRegion  string
	KmsSDKScheme  string
}

type KMSPrivateKeyConfig

type KMSPrivateKeyConfig struct {
	KeyType  string `json:"key_type"`
	KeyId    string `json:"key_id"`
	KeyAlias string `json:"key_alias"`
}

type PrivateKey

type PrivateKey struct {
	// contains filtered or unexported fields
}

func (*PrivateKey) Bytes

func (sk *PrivateKey) Bytes() ([]byte, error)

func (*PrivateKey) PublicKey

func (sk *PrivateKey) PublicKey() bccrypto.PublicKey

func (*PrivateKey) Sign

func (sk *PrivateKey) Sign(data []byte) ([]byte, error)

func (*PrivateKey) SignWithOpts

func (sk *PrivateKey) SignWithOpts(msg []byte, opts *bccrypto.SignOpts) ([]byte, error)

func (*PrivateKey) String

func (sk *PrivateKey) String() (string, error)

func (*PrivateKey) ToStandardKey

func (sk *PrivateKey) ToStandardKey() crypto.PrivateKey

func (*PrivateKey) Type

func (sk *PrivateKey) Type() bccrypto.KeyType

type Signer

type Signer struct {
	// contains filtered or unexported fields
}

func (*Signer) Public

func (signer *Signer) Public() crypto.PublicKey

func (*Signer) Sign

func (signer *Signer) Sign(rand io.Reader, digest []byte, opts crypto.SignerOpts) (signature []byte, err error)

Jump to

Keyboard shortcuts

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