Documentation ¶
Index ¶
- Constants
- Variables
- func AddCipher(oid asn1.ObjectIdentifier, cipher func() Cipher)
- func AddKey(name string, key func() Key)
- func DecodeData(encodedData, password []byte) ([]byte, error)
- func DecryptedPrivateKeyInfo(data []byte) ([]byte, error)
- func EncodeData(data []byte, password string, cipher ...Cipher) ([]byte, error)
- func EncryptedPrivateKeyInfo(algorithm asn1.ObjectIdentifier, data []byte) ([]byte, error)
- func GetPKCS8PrivateKeyAlgorithm(privateKey crypto.PrivateKey) (string, error)
- func GetPKCS8PublicKeyAlgorithm(publicKey crypto.PublicKey) (string, error)
- func GetStructName(s any) (name string)
- func MarshalPKCS8PrivateKey(privateKey crypto.PrivateKey) ([]byte, error)
- func MarshalPKCS8PublicKey(publicKey crypto.PublicKey) ([]byte, error)
- func ParsePKCS8PrivateKey(pkData []byte) (privateKey crypto.PrivateKey, err error)
- func ParsePKCS8PublicKey(pkData []byte) (publicKey crypto.PublicKey, err error)
- type BKS
- func (this *BKS) AddCert(alias string, certData *x509.Certificate, certChain []*x509.Certificate) error
- func (this *BKS) AddCertBytes(alias string, certData []byte, certChain [][]byte) error
- func (this *BKS) AddKeyPrivate(alias string, privateKey crypto.PrivateKey, certChain []*x509.Certificate) error
- func (this *BKS) AddKeyPrivateBytes(alias string, privateKey []byte, algorithm string, certChain [][]byte) error
- func (this *BKS) AddKeyPrivateWithPassword(alias string, privateKey crypto.PrivateKey, password string, ...) error
- func (this *BKS) AddKeyPrivateWithPasswordBytes(alias string, privateKey []byte, algorithm string, password string, ...) error
- func (this *BKS) AddKeyPublic(alias string, publicKey crypto.PublicKey, certChain []*x509.Certificate) error
- func (this *BKS) AddKeyPublicBytes(alias string, publicKey []byte, algorithm string, certChain [][]byte) error
- func (this *BKS) AddKeyPublicWithPassword(alias string, publicKey crypto.PublicKey, password string, ...) error
- func (this *BKS) AddKeyPublicWithPasswordBytes(alias string, publicKey []byte, algorithm string, password string, ...) error
- func (this *BKS) AddKeySecret(alias string, secret []byte, algorithm string, certChain []*x509.Certificate) error
- func (this *BKS) AddKeySecretBytes(alias string, secret []byte, algorithm string, certChain [][]byte) error
- func (this *BKS) AddKeySecretWithPassword(alias string, secret []byte, password string, algorithm string, ...) error
- func (this *BKS) AddKeySecretWithPasswordBytes(alias string, secret []byte, password string, algorithm string, ...) error
- func (this *BKS) AddSecret(alias string, secretData []byte, certChain []*x509.Certificate) error
- func (this *BKS) AddSecretBytes(alias string, secretData []byte, certChain [][]byte) error
- func (this *BKS) GetCert(alias string) (cert *x509.Certificate, err error)
- func (this *BKS) GetCertBytes(alias string) (cert []byte, err error)
- func (this *BKS) GetCertChain(alias string) (certChain []*x509.Certificate, err error)
- func (this *BKS) GetCertChainBytes(alias string) (certChain [][]byte, err error)
- func (this *BKS) GetCertType(alias string) (certType string, err error)
- func (this *BKS) GetCreateDate(alias string) (date time.Time, err error)
- func (this *BKS) GetKey(alias string) (private crypto.PrivateKey, public crypto.PublicKey, secret []byte, err error)
- func (this *BKS) GetKeyPrivate(alias string) (private crypto.PrivateKey, err error)
- func (this *BKS) GetKeyPrivateWithPassword(alias string, password string) (private crypto.PrivateKey, err error)
- func (this *BKS) GetKeyPublic(alias string) (public crypto.PublicKey, err error)
- func (this *BKS) GetKeyPublicWithPassword(alias string, password string) (public crypto.PublicKey, err error)
- func (this *BKS) GetKeySecret(alias string) (secret []byte, err error)
- func (this *BKS) GetKeySecretWithPassword(alias string, password string) (secret []byte, err error)
- func (this *BKS) GetKeyType(alias string) (keyType string, err error)
- func (this *BKS) GetSealedKey(alias string, password string) (private crypto.PrivateKey, public crypto.PublicKey, secret []byte, err error)
- func (this *BKS) GetSealedKeyType(alias string, password string) (keyType string, err error)
- func (this *BKS) GetSecret(alias string) (secret []byte, err error)
- func (this *BKS) ListCerts() []string
- func (this *BKS) ListKeys() []string
- func (this *BKS) ListSealedKeys() []string
- func (this *BKS) ListSecrets() []string
- func (this *BKS) Marshal(password string, opts ...BKSOpts) ([]byte, error)
- func (this *BKS) Parse(r io.Reader, password string) error
- func (this *BKS) StoreType() string
- func (this *BKS) String() string
- func (this *BKS) Version() uint32
- type BKSOpts
- type BksDataEntry
- type BksEntry
- type Cipher
- type CipherBlockCBC
- func (this CipherBlockCBC) Decrypt(password, params, ciphertext []byte) ([]byte, error)
- func (this CipherBlockCBC) Encrypt(password, plaintext []byte) ([]byte, []byte, error)
- func (this CipherBlockCBC) KeySize() int
- func (this CipherBlockCBC) OID() asn1.ObjectIdentifier
- func (this CipherBlockCBC) WithSaltSize(saltSize int) CipherBlockCBC
- type JCEKS
- func (this *JCEKS) AddPrivateKey(alias string, privateKey crypto.PrivateKey, password string, ...) error
- func (this *JCEKS) AddPrivateKeyBytes(alias string, privateKey []byte, password string, certs [][]byte, ...) error
- func (this *JCEKS) AddSecretKey(alias string, secretKey []byte, password string, cipher ...Cipher) error
- func (this *JCEKS) AddTrustedCert(alias string, cert *x509.Certificate) error
- func (this *JCEKS) AddTrustedCertBytes(alias string, cert []byte) error
- func (this *JCEKS) GetCert(alias string) (*x509.Certificate, error)
- func (this *JCEKS) GetCertBytes(alias string) ([]byte, error)
- func (this *JCEKS) GetPrivateKeyAndCerts(alias string, password string) (key crypto.PrivateKey, certs []*x509.Certificate, err error)
- func (this *JCEKS) GetPrivateKeyAndCertsBytes(alias string, password string) (key []byte, certs [][]byte, err error)
- func (this *JCEKS) GetSecretKey(alias string, password string) (key []byte, err error)
- func (this *JCEKS) ListCerts() []string
- func (this *JCEKS) ListPrivateKeys() []string
- func (this *JCEKS) ListSecretKeys() []string
- func (this *JCEKS) Marshal(password string) ([]byte, error)
- func (this *JCEKS) Parse(r io.Reader, password string) error
- func (this *JCEKS) String() string
- type JKS
- func (this *JKS) AddEncodedPrivateKey(alias string, encodedKey []byte, certChain []*x509.Certificate) error
- func (this *JKS) AddEncodedPrivateKeyBytes(alias string, encodedKey []byte, certChain [][]byte) error
- func (this *JKS) AddPrivateKey(alias string, privateKey crypto.PrivateKey, password string, ...) error
- func (this *JKS) AddPrivateKeyBytes(alias string, privateKey []byte, password string, certChain [][]byte) error
- func (this *JKS) AddTrustedCert(alias string, cert *x509.Certificate) error
- func (this *JKS) AddTrustedCertBytes(alias string, cert []byte) error
- func (this *JKS) GetCert(alias string) (*x509.Certificate, error)
- func (this *JKS) GetCertBytes(alias string) ([]byte, error)
- func (this *JKS) GetCertChain(alias string) ([]*x509.Certificate, error)
- func (this *JKS) GetCertChainBytes(alias string) ([][]byte, error)
- func (this *JKS) GetCreateDate(alias string) (time.Time, error)
- func (this *JKS) GetEncodedKey(alias string) ([]byte, error)
- func (this *JKS) GetPrivateKey(alias string, password string) (crypto.PrivateKey, error)
- func (this *JKS) GetPrivateKeyBytes(alias string, password string) (crypto.PrivateKey, error)
- func (this *JKS) ListCerts() []string
- func (this *JKS) ListPrivateKeys() []string
- func (this *JKS) Marshal(password string) ([]byte, error)
- func (this *JKS) Parse(r io.Reader, password string) error
- func (this *JKS) String() string
- type Key
- type KeyDSA
- func (this KeyDSA) Algorithm() string
- func (this KeyDSA) MarshalPKCS8PrivateKey(privateKey crypto.PrivateKey) ([]byte, error)
- func (this KeyDSA) MarshalPKCS8PublicKey(publicKey crypto.PublicKey) ([]byte, error)
- func (this KeyDSA) ParsePKCS8PrivateKey(pkData []byte) (crypto.PrivateKey, error)
- func (this KeyDSA) ParsePKCS8PublicKey(pkData []byte) (crypto.PublicKey, error)
- type KeyEcdsa
- func (this KeyEcdsa) Algorithm() string
- func (this KeyEcdsa) MarshalPKCS8PrivateKey(privateKey crypto.PrivateKey) ([]byte, error)
- func (this KeyEcdsa) MarshalPKCS8PublicKey(publicKey crypto.PublicKey) ([]byte, error)
- func (this KeyEcdsa) ParsePKCS8PrivateKey(pkData []byte) (crypto.PrivateKey, error)
- func (this KeyEcdsa) ParsePKCS8PublicKey(pkData []byte) (crypto.PublicKey, error)
- type KeyEdDSA
- func (this KeyEdDSA) Algorithm() string
- func (this KeyEdDSA) MarshalPKCS8PrivateKey(privateKey crypto.PrivateKey) ([]byte, error)
- func (this KeyEdDSA) MarshalPKCS8PublicKey(publicKey crypto.PublicKey) ([]byte, error)
- func (this KeyEdDSA) ParsePKCS8PrivateKey(pkData []byte) (crypto.PrivateKey, error)
- func (this KeyEdDSA) ParsePKCS8PublicKey(pkData []byte) (crypto.PublicKey, error)
- type KeyRsa
- func (this KeyRsa) Algorithm() string
- func (this KeyRsa) MarshalPKCS8PrivateKey(privateKey crypto.PrivateKey) ([]byte, error)
- func (this KeyRsa) MarshalPKCS8PublicKey(publicKey crypto.PublicKey) ([]byte, error)
- func (this KeyRsa) ParsePKCS8PrivateKey(pkData []byte) (crypto.PrivateKey, error)
- func (this KeyRsa) ParsePKCS8PublicKey(pkData []byte) (crypto.PublicKey, error)
- type KeySM2
- func (this KeySM2) Algorithm() string
- func (this KeySM2) MarshalPKCS8PrivateKey(privateKey crypto.PrivateKey) ([]byte, error)
- func (this KeySM2) MarshalPKCS8PublicKey(publicKey crypto.PublicKey) ([]byte, error)
- func (this KeySM2) ParsePKCS8PrivateKey(pkData []byte) (crypto.PrivateKey, error)
- func (this KeySM2) ParsePKCS8PublicKey(pkData []byte) (crypto.PublicKey, error)
- type UBER
- type UBEROpts
Constants ¶
const ( BksVersionV1 = 1 BksVersionV2 = 2 )
const (
UberVersionV1 = 1
)
Variables ¶
var BKSDefaultOpts = BKSOpts{
Version: 1,
SaltSize: 20,
IterationCount: 10000,
}
DefaultOpts
var CipherMD5And3DES = CipherBlockCBC{ // contains filtered or unexported fields }
var CipherSHA1And3DES = CipherBlockCBC{ // contains filtered or unexported fields }
var CipherSHA1And3DESForBKS = CipherBlockCBC{ // contains filtered or unexported fields }
bks 使用
var CipherSHA1AndTwofishForUBER = CipherBlockCBC{ // contains filtered or unexported fields }
var DefaultCipher = CipherMD5And3DES
默认配置
var LoadFromBytes = LoadJceksFromBytes
var LoadFromReader = LoadJceksFromReader
别名
var LoadUber = LoadUberFromBytes
别名
var NewBksEncode = NewBKS
alias
var NewJceksEncode = NewJCEKS
var NewJksEncode = NewJKS
编码
var NewUberEncode = NewUBER
var UBERDefaultOpts = UBEROpts{
SaltSize: 20,
IterationCount: 10000,
}
默认配置
Functions ¶
func EncodeData ¶
加密数据
func EncryptedPrivateKeyInfo ¶
func EncryptedPrivateKeyInfo(algorithm asn1.ObjectIdentifier, data []byte) ([]byte, error)
加密数据
func GetPKCS8PrivateKeyAlgorithm ¶ added in v1.0.1038
func GetPKCS8PrivateKeyAlgorithm(privateKey crypto.PrivateKey) (string, error)
私钥名称
func GetPKCS8PublicKeyAlgorithm ¶ added in v1.0.1038
公钥名称
func MarshalPKCS8PrivateKey ¶
func MarshalPKCS8PrivateKey(privateKey crypto.PrivateKey) ([]byte, error)
从注册的 key 列表编码证书
func MarshalPKCS8PublicKey ¶ added in v1.0.1038
从注册的 key 列表编码公钥证书
func ParsePKCS8PrivateKey ¶
func ParsePKCS8PrivateKey(pkData []byte) (privateKey crypto.PrivateKey, err error)
从注册的 key 列表解析证书
Types ¶
type BKS ¶ added in v1.0.1038
type BKS struct {
// contains filtered or unexported fields
}
*
- BKS *
- @create 2022-9-19
- @author deatil
func LoadBksFromBytes ¶ added in v1.0.1038
LoadBksFromBytes loads the key store from the bytes data.
func LoadBksFromReader ¶ added in v1.0.1038
LoadBksFromReader loads the key store from the specified file.
func (*BKS) AddCert ¶ added in v1.0.1038
func (this *BKS) AddCert(alias string, certData *x509.Certificate, certChain []*x509.Certificate) error
AddCert
func (*BKS) AddCertBytes ¶ added in v1.0.2033
AddCertBytes
func (*BKS) AddKeyPrivate ¶ added in v1.0.1038
func (this *BKS) AddKeyPrivate( alias string, privateKey crypto.PrivateKey, certChain []*x509.Certificate, ) error
AddKeyPrivate
func (*BKS) AddKeyPrivateBytes ¶ added in v1.0.2033
func (this *BKS) AddKeyPrivateBytes( alias string, privateKey []byte, algorithm string, certChain [][]byte, ) error
AddKeyPrivateBytes
func (*BKS) AddKeyPrivateWithPassword ¶ added in v1.0.1038
func (this *BKS) AddKeyPrivateWithPassword( alias string, privateKey crypto.PrivateKey, password string, certChain []*x509.Certificate, ) error
AddKeyPrivateWithPassword
func (*BKS) AddKeyPrivateWithPasswordBytes ¶ added in v1.0.2033
func (this *BKS) AddKeyPrivateWithPasswordBytes( alias string, privateKey []byte, algorithm string, password string, certChain [][]byte, ) error
AddKeyPrivateWithPasswordBytes
func (*BKS) AddKeyPublic ¶ added in v1.0.1038
func (this *BKS) AddKeyPublic( alias string, publicKey crypto.PublicKey, certChain []*x509.Certificate, ) error
AddKeyPublic
func (*BKS) AddKeyPublicBytes ¶ added in v1.0.2033
func (this *BKS) AddKeyPublicBytes( alias string, publicKey []byte, algorithm string, certChain [][]byte, ) error
AddKeyPublicBytes
func (*BKS) AddKeyPublicWithPassword ¶ added in v1.0.1038
func (this *BKS) AddKeyPublicWithPassword( alias string, publicKey crypto.PublicKey, password string, certChain []*x509.Certificate, ) error
AddKeyPublicWithPassword
func (*BKS) AddKeyPublicWithPasswordBytes ¶ added in v1.0.2033
func (this *BKS) AddKeyPublicWithPasswordBytes( alias string, publicKey []byte, algorithm string, password string, certChain [][]byte, ) error
AddKeyPublicWithPasswordBytes
func (*BKS) AddKeySecret ¶ added in v1.0.1038
func (this *BKS) AddKeySecret( alias string, secret []byte, algorithm string, certChain []*x509.Certificate, ) error
AddKeySecret algorithm = "AES"
func (*BKS) AddKeySecretBytes ¶ added in v1.0.2033
func (this *BKS) AddKeySecretBytes( alias string, secret []byte, algorithm string, certChain [][]byte, ) error
AddKeySecretBytes algorithm = "AES"
func (*BKS) AddKeySecretWithPassword ¶ added in v1.0.1038
func (this *BKS) AddKeySecretWithPassword( alias string, secret []byte, password string, algorithm string, certChain []*x509.Certificate, ) error
AddKeySecretWithPassword algorithm = "AES"
func (*BKS) AddKeySecretWithPasswordBytes ¶ added in v1.0.2033
func (this *BKS) AddKeySecretWithPasswordBytes( alias string, secret []byte, password string, algorithm string, certChain [][]byte, ) error
AddKeySecretWithPasswordBytes algorithm = "AES"
func (*BKS) AddSecretBytes ¶ added in v1.0.2033
AddSecretBytes
func (*BKS) GetCert ¶ added in v1.0.1038
func (this *BKS) GetCert(alias string) ( cert *x509.Certificate, err error, )
GetCert
func (*BKS) GetCertBytes ¶ added in v1.0.1038
GetCertBytes
func (*BKS) GetCertChain ¶ added in v1.0.1038
func (this *BKS) GetCertChain(alias string) (certChain []*x509.Certificate, err error)
GetCertChain
func (*BKS) GetCertChainBytes ¶ added in v1.0.1038
GetCertChainBytes
func (*BKS) GetCertType ¶ added in v1.0.1038
GetCertType
func (*BKS) GetCreateDate ¶ added in v1.0.1038
GetCreateDate
func (*BKS) GetKey ¶ added in v1.0.1038
func (this *BKS) GetKey(alias string) ( private crypto.PrivateKey, public crypto.PublicKey, secret []byte, err error, )
GetKey
func (*BKS) GetKeyPrivate ¶ added in v1.0.1038
func (this *BKS) GetKeyPrivate(alias string) (private crypto.PrivateKey, err error)
GetKeyPrivate
func (*BKS) GetKeyPrivateWithPassword ¶ added in v1.0.1038
func (this *BKS) GetKeyPrivateWithPassword(alias string, password string) (private crypto.PrivateKey, err error)
GetKeyPrivateWithPassword
func (*BKS) GetKeyPublic ¶ added in v1.0.1038
GetKeyPublic
func (*BKS) GetKeyPublicWithPassword ¶ added in v1.0.1038
func (this *BKS) GetKeyPublicWithPassword(alias string, password string) (public crypto.PublicKey, err error)
GetKeyPublicWithPassword
func (*BKS) GetKeySecret ¶ added in v1.0.1038
GetKeySecret
func (*BKS) GetKeySecretWithPassword ¶ added in v1.0.1038
GetKeySecretWithPassword
func (*BKS) GetKeyType ¶ added in v1.0.1038
GetKeyType
func (*BKS) GetSealedKey ¶ added in v1.0.1038
func (this *BKS) GetSealedKey(alias string, password string) ( private crypto.PrivateKey, public crypto.PublicKey, secret []byte, err error, )
GetSealedKey
func (*BKS) GetSealedKeyType ¶ added in v1.0.1038
GetSealedKeyType
func (*BKS) ListSealedKeys ¶ added in v1.0.1038
ListSealedKeys
func (*BKS) ListSecrets ¶ added in v1.0.1040
ListSecrets lists the names of the SecretKey stored in the key store.
type BksDataEntry ¶ added in v1.0.1038
type Cipher ¶
type Cipher interface { // oid OID() asn1.ObjectIdentifier // 值大小 KeySize() int // 加密, 返回: [加密后数据, 参数, error] Encrypt(key, plaintext []byte) ([]byte, []byte, error) // 解密 Decrypt(key, params, ciphertext []byte) ([]byte, error) }
加密接口
type CipherBlockCBC ¶
type CipherBlockCBC struct {
// contains filtered or unexported fields
}
cbc 模式加密
func (CipherBlockCBC) Decrypt ¶
func (this CipherBlockCBC) Decrypt(password, params, ciphertext []byte) ([]byte, error)
解密
func (CipherBlockCBC) Encrypt ¶
func (this CipherBlockCBC) Encrypt(password, plaintext []byte) ([]byte, []byte, error)
加密
func (CipherBlockCBC) WithSaltSize ¶
func (this CipherBlockCBC) WithSaltSize(saltSize int) CipherBlockCBC
设置 saltSize
type JCEKS ¶ added in v1.0.1036
type JCEKS struct {
// contains filtered or unexported fields
}
*
- JCEKS *
- @create 2022-9-19
- @author deatil
func LoadJceksFromBytes ¶
LoadJceksFromBytes loads the key store from the bytes data.
func LoadJceksFromReader ¶
LoadJceksFromReader loads the key store from the specified file.
func (*JCEKS) AddPrivateKey ¶ added in v1.0.1036
func (this *JCEKS) AddPrivateKey( alias string, privateKey crypto.PrivateKey, password string, certs []*x509.Certificate, cipher ...Cipher, ) error
添加私钥
func (*JCEKS) AddPrivateKeyBytes ¶ added in v1.0.2033
func (this *JCEKS) AddPrivateKeyBytes( alias string, privateKey []byte, password string, certs [][]byte, cipher ...Cipher, ) error
添加私钥
func (*JCEKS) AddSecretKey ¶ added in v1.0.1036
func (this *JCEKS) AddSecretKey( alias string, secretKey []byte, password string, cipher ...Cipher, ) error
添加密钥
func (*JCEKS) AddTrustedCert ¶ added in v1.0.1036
func (this *JCEKS) AddTrustedCert( alias string, cert *x509.Certificate, ) error
添加证书
func (*JCEKS) AddTrustedCertBytes ¶ added in v1.0.2033
添加证书
func (*JCEKS) GetCert ¶ added in v1.0.1036
func (this *JCEKS) GetCert(alias string) (*x509.Certificate, error)
GetCert
func (*JCEKS) GetCertBytes ¶ added in v1.0.1036
GetCertBytes
func (*JCEKS) GetPrivateKeyAndCerts ¶ added in v1.0.1036
func (this *JCEKS) GetPrivateKeyAndCerts(alias string, password string) ( key crypto.PrivateKey, certs []*x509.Certificate, err error, )
GetPrivateKeyAndCerts
func (*JCEKS) GetPrivateKeyAndCertsBytes ¶ added in v1.0.1036
func (this *JCEKS) GetPrivateKeyAndCertsBytes(alias string, password string) ( key []byte, certs [][]byte, err error, )
GetPrivateKeyAndCertsBytes
func (*JCEKS) GetSecretKey ¶ added in v1.0.1036
GetSecretKey
func (*JCEKS) ListPrivateKeys ¶ added in v1.0.1036
ListPrivateKeys
func (*JCEKS) ListSecretKeys ¶ added in v1.0.1036
ListSecretKeys lists the names of the SecretKey stored in the key store.
type JKS ¶ added in v1.0.1036
type JKS struct {
// contains filtered or unexported fields
}
*
- Jks *
- @create 2022-9-19
- @author deatil
func LoadJksFromBytes ¶
LoadFromBytes loads the key store from the bytes data.
func LoadJksFromReader ¶
LoadJksFromReader loads the key store from the specified file.
func (*JKS) AddEncodedPrivateKey ¶ added in v1.0.1036
func (this *JKS) AddEncodedPrivateKey( alias string, encodedKey []byte, certChain []*x509.Certificate, ) error
添加已加密私钥
func (*JKS) AddEncodedPrivateKeyBytes ¶ added in v1.0.2033
func (this *JKS) AddEncodedPrivateKeyBytes( alias string, encodedKey []byte, certChain [][]byte, ) error
添加已加密私钥
func (*JKS) AddPrivateKey ¶ added in v1.0.1036
func (this *JKS) AddPrivateKey( alias string, privateKey crypto.PrivateKey, password string, certChain []*x509.Certificate, ) error
添加私钥
func (*JKS) AddPrivateKeyBytes ¶ added in v1.0.2033
func (this *JKS) AddPrivateKeyBytes( alias string, privateKey []byte, password string, certChain [][]byte, ) error
添加私钥
func (*JKS) AddTrustedCert ¶ added in v1.0.1036
func (this *JKS) AddTrustedCert( alias string, cert *x509.Certificate, ) error
添加证书
func (*JKS) AddTrustedCertBytes ¶ added in v1.0.2033
添加证书
func (*JKS) GetCert ¶ added in v1.0.1036
func (this *JKS) GetCert(alias string) (*x509.Certificate, error)
GetCert
func (*JKS) GetCertBytes ¶ added in v1.0.1036
GetCertBytes
func (*JKS) GetCertChain ¶ added in v1.0.1036
func (this *JKS) GetCertChain(alias string) ([]*x509.Certificate, error)
GetCertChain
func (*JKS) GetCertChainBytes ¶ added in v1.0.1036
GetCertChainBytes
func (*JKS) GetCreateDate ¶ added in v1.0.1036
GetCreateDate
func (*JKS) GetEncodedKey ¶ added in v1.0.1036
GetEncodedKey
func (*JKS) GetPrivateKey ¶ added in v1.0.1036
GetPrivateKey
func (*JKS) GetPrivateKeyBytes ¶ added in v1.0.2033
GetPrivateKeyBytes
func (*JKS) ListPrivateKeys ¶ added in v1.0.1036
ListPrivateKeys
type Key ¶
type Key interface { // 包装 PKCS8 私钥证书 MarshalPKCS8PrivateKey(privateKey crypto.PrivateKey) (pkData []byte, err error) // 解析 PKCS8 私钥证书 ParsePKCS8PrivateKey(pkData []byte) (crypto.PrivateKey, error) // 包装 PKCS8 公钥证书 MarshalPKCS8PublicKey(publicKey crypto.PublicKey) ([]byte, error) // 解析 PKCS8 公钥证书 ParsePKCS8PublicKey(pkData []byte) (crypto.PublicKey, error) // 名称 Algorithm() string }
Key 接口
type KeyDSA ¶
type KeyDSA struct{}
DSA
func (KeyDSA) MarshalPKCS8PrivateKey ¶
func (this KeyDSA) MarshalPKCS8PrivateKey(privateKey crypto.PrivateKey) ([]byte, error)
包装
func (KeyDSA) MarshalPKCS8PublicKey ¶ added in v1.0.1038
包装公钥
func (KeyDSA) ParsePKCS8PrivateKey ¶
func (this KeyDSA) ParsePKCS8PrivateKey(pkData []byte) (crypto.PrivateKey, error)
解析
type KeyEcdsa ¶
type KeyEcdsa struct{}
Ecdsa
func (KeyEcdsa) MarshalPKCS8PrivateKey ¶
func (this KeyEcdsa) MarshalPKCS8PrivateKey(privateKey crypto.PrivateKey) ([]byte, error)
包装
func (KeyEcdsa) MarshalPKCS8PublicKey ¶ added in v1.0.1038
包装公钥
func (KeyEcdsa) ParsePKCS8PrivateKey ¶
func (this KeyEcdsa) ParsePKCS8PrivateKey(pkData []byte) (crypto.PrivateKey, error)
解析
type KeyEdDSA ¶
type KeyEdDSA struct{}
EdDSA
func (KeyEdDSA) MarshalPKCS8PrivateKey ¶
func (this KeyEdDSA) MarshalPKCS8PrivateKey(privateKey crypto.PrivateKey) ([]byte, error)
包装
func (KeyEdDSA) MarshalPKCS8PublicKey ¶ added in v1.0.1038
包装公钥
func (KeyEdDSA) ParsePKCS8PrivateKey ¶
func (this KeyEdDSA) ParsePKCS8PrivateKey(pkData []byte) (crypto.PrivateKey, error)
解析
type KeyRsa ¶
type KeyRsa struct{}
rsa
func (KeyRsa) MarshalPKCS8PrivateKey ¶
func (this KeyRsa) MarshalPKCS8PrivateKey(privateKey crypto.PrivateKey) ([]byte, error)
包装
func (KeyRsa) MarshalPKCS8PublicKey ¶ added in v1.0.1038
包装公钥
func (KeyRsa) ParsePKCS8PrivateKey ¶
func (this KeyRsa) ParsePKCS8PrivateKey(pkData []byte) (crypto.PrivateKey, error)
解析
type KeySM2 ¶
type KeySM2 struct{}
SM2
func (KeySM2) MarshalPKCS8PrivateKey ¶
func (this KeySM2) MarshalPKCS8PrivateKey(privateKey crypto.PrivateKey) ([]byte, error)
包装
func (KeySM2) MarshalPKCS8PublicKey ¶ added in v1.0.1038
包装公钥
func (KeySM2) ParsePKCS8PrivateKey ¶
func (this KeySM2) ParsePKCS8PrivateKey(pkData []byte) (crypto.PrivateKey, error)
解析
type UBER ¶ added in v1.0.1038
type UBER struct {
BKS
}
*
- UBER *
- @create 2022-9-19
- @author deatil
func LoadUberFromBytes ¶ added in v1.0.1038
LoadUberFromBytes loads the key store from the bytes data.
func LoadUberFromReader ¶ added in v1.0.1049
LoadUberFromReader
Source Files ¶
- binary.go
- bks.go
- bks_decode.go
- bks_encode.go
- bks_entry.go
- bks_utils.go
- cipher.go
- cipher_blockcbc.go
- cipher_key.go
- cipher_setting.go
- consts.go
- interfaces.go
- jceks.go
- jceks_decode.go
- jceks_encode.go
- jceks_entry.go
- jceks_utils.go
- jks.go
- jks_decode.go
- jks_encode.go
- jks_encryptkey.go
- jks_utils.go
- key.go
- key_dsa.go
- key_ecdsa.go
- key_eddsa.go
- key_rsa.go
- key_setting.go
- key_sm2.go
- uber.go
- uber_decode.go
- uber_encode.go