kms

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: 10 Imported by: 1

Documentation

Overview

Package kms config

nolint

Index

Constants

This section is empty.

Variables

View Source
var Adapter defaultAdapter

Adapter variable must be defined nolint

Functions

This section is empty.

Types

type Config

type Config struct {
	SecretId  string
	SecretKey string
	Address   string
	Region    string
	SDKScheme string

	IsPublic bool
}

Config Kms Configuration

type IKMSAdapter

type IKMSAdapter interface {
	// NewPrivateKey returns a kms PrivateKey
	NewPrivateKey(key PrivateKey) (bccrypto.PrivateKey, error)

	// NewPublicKey returns a kms PublicKey
	NewPublicKey(keyId string) (bccrypto.PublicKey, error)
}

IKMSAdapter is kms adapter interface

func GetKMSAdapter

func GetKMSAdapter(config *Config) IKMSAdapter

GetKMSAdapter returns a kms adapter

func LoadFromEnv

func LoadFromEnv() (IKMSAdapter, error)

LoadFromEnv load a kms adapter which set by env

func NewDefaultAdapter

func NewDefaultAdapter(config *Config) (IKMSAdapter, error)

NewDefaultAdapter return a default kms adapter

type KeyType

type KeyType string
const (
	SM2      KeyType = "SM2"
	ECC_P256 KeyType = "ECC_P256"

	SM4     KeyType = "SM4"
	AES_128 KeyType = "AES_128"
	AES_192 KeyType = "AES_192"
	AES_256 KeyType = "AES_256"
)

type PrivateKey

type PrivateKey struct {
	KeyId     string
	KeyType   string
	KeyAlias  string
	ExtParams map[string]string
}

PrivateKey kms private key struct

Directories

Path Synopsis
nolint

Jump to

Keyboard shortcuts

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