Documentation ¶
Index ¶
- Variables
- func AddParamsForCurve(curve elliptic.Curve, params *ECIESParams)
- func EciesDecrypt(prv PrivateKey, c, s1, s2 []byte) (m []byte, err error)
- func MaxSharedKeyLength(pub *ecdsa.PublicKey) int
- type App
- type ConfigFile
- type ConfigStruct
- type CryptoHandler
- type ECIESParams
- type EciesCrypto
- type PrivateKey
- type PrivateKeyLocal
- type PrivateKeyPkcs11
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidCurve = fmt.Errorf("ecies: invalid elliptic curve") ErrInvalidPublicKey = fmt.Errorf("ecies: invalid public key") )
View Source
var ( ErrInvalidMessage = fmt.Errorf("ecies: invalid message") )
View Source
var ( DefaultCurve = ethcrypto.S256() ErrUnsupportedECDHAlgorithm = fmt.Errorf("ecies: unsupported ECDH algorithm") ErrUnsupportedECIESParameters = fmt.Errorf("ecies: unsupported ECIES parameters") ErrInvalidKeyLen = fmt.Errorf("ecies: invalid key size (> %d) in ECIESParams", maxKeyLen) )
View Source
var ( ECIES_AES128_SHA256 = &ECIESParams{ Hash: sha256.New, hashAlgo: crypto.SHA256, Cipher: aes.NewCipher, BlockSize: aes.BlockSize, KeyLen: 16, } ECIES_AES256_SHA256 = &ECIESParams{ Hash: sha256.New, hashAlgo: crypto.SHA256, Cipher: aes.NewCipher, BlockSize: aes.BlockSize, KeyLen: 32, } ECIES_AES256_SHA384 = &ECIESParams{ Hash: sha512.New384, hashAlgo: crypto.SHA384, Cipher: aes.NewCipher, BlockSize: aes.BlockSize, KeyLen: 32, } ECIES_AES256_SHA512 = &ECIESParams{ Hash: sha512.New, hashAlgo: crypto.SHA512, Cipher: aes.NewCipher, BlockSize: aes.BlockSize, KeyLen: 32, } )
View Source
var Commit string
View Source
var NotModifiedError = errors.New("Config unchanged on server")
Functions ¶
func AddParamsForCurve ¶
func AddParamsForCurve(curve elliptic.Curve, params *ECIESParams)
func EciesDecrypt ¶
func EciesDecrypt(prv PrivateKey, c, s1, s2 []byte) (m []byte, err error)
Decrypt decrypts an ECIES ciphertext.
func MaxSharedKeyLength ¶
MaxSharedKeyLength returns the maximum length of the shared key the public key can produce.
Types ¶
type App ¶
type App struct { EncryptedConfig string SecretsDir string // contains filtered or unexported fields }
func (*App) CallInitFunctions ¶
func (a *App) CallInitFunctions()
type ConfigFile ¶
type ConfigStruct ¶
type ConfigStruct = map[string]*ConfigFile
func UnmarshallBuffer ¶
func UnmarshallBuffer(c CryptoHandler, encContent []byte, decrypt bool) (ConfigStruct, error)
func UnmarshallFile ¶
func UnmarshallFile(c CryptoHandler, encFile string, decrypt bool) (ConfigStruct, error)
type CryptoHandler ¶
func NewEciesLocalHandler ¶
func NewEciesLocalHandler(privKey crypto.PrivateKey) CryptoHandler
func NewEciesPkcs11Handler ¶
func NewEciesPkcs11Handler(ctx *crypto11.Context, privKey crypto11.Signer) CryptoHandler
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 }
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.
type EciesCrypto ¶
type EciesCrypto struct { PrivKey PrivateKey // contains filtered or unexported fields }
func (*EciesCrypto) Close ¶
func (ec *EciesCrypto) Close()
type PrivateKey ¶
type PrivateKeyLocal ¶
type PrivateKeyLocal struct {
*ecdsa.PrivateKey
}
PrivateKeyLocal is a representation of an elliptic curve private key.
func ImportECDSA ¶
func ImportECDSA(prv *ecdsa.PrivateKey) *PrivateKeyLocal
Import an ECDSA private key as an ECIES private key.
func (*PrivateKeyLocal) GenerateShared ¶
func (prv *PrivateKeyLocal) GenerateShared(pub *ecdsa.PublicKey, skLen, macLen int) (sk []byte, err error)
ECDH key agreement method used to establish secret keys for encryption.
func (*PrivateKeyLocal) Public ¶
func (prv *PrivateKeyLocal) Public() *ecdsa.PublicKey
type PrivateKeyPkcs11 ¶
type PrivateKeyPkcs11 struct {
// contains filtered or unexported fields
}
func ImportPcks11 ¶
func ImportPcks11(ctx *crypto11.Context, privKey crypto.PrivateKey) *PrivateKeyPkcs11
func (*PrivateKeyPkcs11) GenerateShared ¶
func (*PrivateKeyPkcs11) Public ¶
func (prv *PrivateKeyPkcs11) Public() *ecdsa.PublicKey
Click to show internal directories.
Click to hide internal directories.