Documentation ¶
Index ¶
- Constants
- Variables
- func DERToPrivateKey(data []byte) (interface{}, error)
- func DERToPublicKey(data []byte) (interface{}, error)
- func PEMToPrivateKey(data []byte) (interface{}, error)
- func PEMToPublicKey(data []byte) (interface{}, error)
- func PrivateKeyToPEM(pri Key) ([]byte, error)
- func PublicKeyToPEM(pub Key) ([]byte, error)
- type Crypto
- type ECDSAKeyGenOpts
- type Key
- type KeyGenOpts
- type RSAKeyGenOpts
- type SignerOpts
Constants ¶
View Source
const ( RSA = "RSA" ECDSA = "ECDSA" )
View Source
const ( PRIVATE_KEY keyType = "pri" PUBLIC_KEY keyType = "pub" )
Variables ¶
View Source
var DefaultRSAOption = &rsa.PSSOptions{SaltLength: rsa.PSSSaltLengthEqualsHash, Hash: crypto.SHA256}
Functions ¶
func DERToPrivateKey ¶
func DERToPublicKey ¶
func PEMToPrivateKey ¶
func PEMToPublicKey ¶
func PrivateKeyToPEM ¶
func PublicKeyToPEM ¶
Types ¶
type Crypto ¶
type Crypto interface { Sign(data []byte, opts SignerOpts) ([]byte, error) Verify(key Key, signature, digest []byte, opts SignerOpts) (bool, error) GetKey() (pri, pub Key, err error) }
func NewCryptoImpl ¶
func NewCryptoImpl(path string, keyGenOpts KeyGenOpts) (Crypto, error)
type ECDSAKeyGenOpts ¶
type ECDSAKeyGenOpts struct{}
func (*ECDSAKeyGenOpts) Algorithm ¶
func (opts *ECDSAKeyGenOpts) Algorithm() string
type KeyGenOpts ¶
type KeyGenOpts interface {
Algorithm() string
}
type RSAKeyGenOpts ¶
type RSAKeyGenOpts struct{}
func (*RSAKeyGenOpts) Algorithm ¶
func (opts *RSAKeyGenOpts) Algorithm() string
type SignerOpts ¶
type SignerOpts interface { crypto.SignerOpts }
Click to show internal directories.
Click to hide internal directories.