Documentation
¶
Index ¶
- Variables
- func CheckHMAC(h func() hash.Hash, message, messageMAC, key []byte) bool
- func GetDN(name pkix.Name) string
- func HashSha256(data []byte) []byte
- func HashSha512(data []byte) []byte
- func NewHMAC(h func() hash.Hash, message, key []byte) []byte
- func ParseCertPem(pemBytes []byte) (cert *x509.Certificate, err error)
- func ParseCertPemOrPanic(pemBytes []byte) *x509.Certificate
- func ToCertPem(cert *x509.Certificate) []byte
- type ECDSASignature
- type ECIESParams
- type ECPriv
- type ECPub
- type PKCS8
Constants ¶
This section is empty.
Variables ¶
var ( ECIES_AES128_SHA256 = ECIESParams{ Hash: sha256.New, Cipher: aes.NewCipher, BlockSize: aes.BlockSize, KeyLen: 16, // contains filtered or unexported fields } ECIES_AES256_SHA256 = ECIESParams{ Hash: sha256.New, Cipher: aes.NewCipher, BlockSize: aes.BlockSize, KeyLen: 32, // contains filtered or unexported fields } ECIES_AES256_SHA384 = ECIESParams{ Hash: sha512.New384, Cipher: aes.NewCipher, BlockSize: aes.BlockSize, KeyLen: 32, // contains filtered or unexported fields } ECIES_AES256_SHA512 = ECIESParams{ Hash: sha512.New, Cipher: aes.NewCipher, BlockSize: aes.BlockSize, KeyLen: 32, // contains filtered or unexported fields } )
var AttributeTypeNames = map[string]string{
"2.5.4.6": "C",
"2.5.4.10": "O",
"2.5.4.11": "OU",
"2.5.4.3": "CN",
"2.5.4.5": "SERIALNUMBER",
"2.5.4.7": "L",
"2.5.4.8": "ST",
"2.5.4.9": "STREET",
"2.5.4.17": "POSTALCODE",
}
Functions ¶
func GetDN ¶
GetDN Get the DN (distinguished name) associated with a pkix.Name. NOTE: This code is almost a direct copy of the String() function in https://go-review.googlesource.com/c/go/+/67270/1/src/crypto/x509/pkix/pkix.go#26 which returns a DN as defined by RFC 2253.
func HashSha256 ¶
func HashSha512 ¶
func ParseCertPem ¶
func ParseCertPem(pemBytes []byte) (cert *x509.Certificate, err error)
ParseCertPem used in server app
func ParseCertPemOrPanic ¶ added in v1.5.3
func ParseCertPemOrPanic(pemBytes []byte) *x509.Certificate
func ToCertPem ¶ added in v1.5.7
func ToCertPem(cert *x509.Certificate) []byte
Types ¶
type ECDSASignature ¶
func (ECDSASignature) MarshalOrPanic ¶ added in v1.5.10
func (t ECDSASignature) MarshalOrPanic() []byte
func (ECDSASignature) UnmarshalOrPanic ¶ added in v1.5.10
func (ECDSASignature) UnmarshalOrPanic(signature []byte) (ecdsaSignature ECDSASignature)
type ECIESParams ¶
type ECIESParams struct {
Hash func() hash.Hash // hash function
Cipher func([]byte) (cipher.Block, error) // symmetric cipher
BlockSize int // block size of symmetric cipher
KeyLen int // length of symmetric key
// contains filtered or unexported fields
}
ECIESParams ECDH , inspired by go-ethereum
func ParamsFromCurve ¶
func ParamsFromCurve(curve elliptic.Curve) (params ECIESParams)
ParamsFromCurve selects parameters optimal for the selected elliptic curve. Only the curves P256, P384, and P512 are supported.
func (ECIESParams) SymDecrypt ¶
func (params ECIESParams) SymDecrypt(key, cipherText []byte) (m []byte)
SymDecrypt carries out CTR decryption using the block cipher specified in the parameters
func (ECIESParams) SymEncrypt ¶
func (params ECIESParams) SymEncrypt(rand io.Reader, key, m []byte) (cipherText []byte)
SymEncrypt carries out CTR encryption using the block cipher specified in the parameters.
type ECPriv ¶
type ECPriv struct {
*ecdsa.PrivateKey
}
ECPriv Used for both ECDSA and ECDH
func (ECPriv) GenerateShared ¶
ECDH key agreement method used to establish secret keys for encryption.