Documentation
¶
Index ¶
- func ValidateHashFunction(HashAlgorithm HashAlgorithm) bool
- func ValidateMethod(KeyType KeyType) bool
- type CryptoContext
- type CryptoContextError
- type CryptoFilter
- type CryptoHashParameter
- type CryptoIdentifier
- type CryptoKey
- type CryptoKeyParameter
- type CryptoKeySet
- type CryptoLogLevel
- type CryptoLogger
- type CryptoProvider
- type CryptoProviderModule
- type HashAlgorithm
- type KeyType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateHashFunction ¶
func ValidateHashFunction(HashAlgorithm HashAlgorithm) bool
func ValidateMethod ¶
Types ¶
type CryptoContext ¶
type CryptoContextError ¶
type CryptoContextError struct {
Err error
}
func (*CryptoContextError) Error ¶
func (e *CryptoContextError) Error() string
type CryptoFilter ¶
type CryptoFilter struct {
Id string
Filter regexp.Regexp
CryptoContext CryptoContext
}
type CryptoHashParameter ¶
type CryptoHashParameter struct {
Identifier CryptoIdentifier
HashAlgorithm HashAlgorithm
}
type CryptoIdentifier ¶
type CryptoIdentifier struct {
KeyId string
CryptoContext CryptoContext
}
type CryptoKey ¶
type CryptoKey struct {
Key []byte //pem format expected in case of key pair
Version string
CryptoKeyParameter
}
type CryptoKeyParameter ¶
type CryptoKeyParameter struct {
Identifier CryptoIdentifier
KeyType KeyType
Params json.RawMessage
}
type CryptoKeySet ¶
type CryptoKeySet struct {
Keys []CryptoKey
}
type CryptoLogLevel ¶
type CryptoLogLevel string
const ( DEBUG CryptoLogLevel = "DEBUG" INFO CryptoLogLevel = "INFO" FATAL CryptoLogLevel = "FATAL" LOG CryptoLogLevel = "LOG" )
type CryptoLogger ¶
type CryptoLogger interface {
Log(level CryptoLogLevel, msg string, err error)
}
type CryptoProvider ¶
type CryptoProvider interface {
/*
Crypto Context Creation Methods. Create the context before any other method.
*/
CreateCryptoContext(context CryptoContext) error
DestroyCryptoContext(context CryptoContext) error
IsCryptoContextExisting(context CryptoContext) (bool, error)
/*
Methods which are just working with created Crypto Context. Ensure that the existing context is checked before execute operations.
*/
GetNamespaces(context CryptoContext) ([]string, error)
GenerateRandom(context CryptoContext, number int) ([]byte, error)
Hash(parameter CryptoHashParameter, msg []byte) ([]byte, error)
Encrypt(parameter CryptoIdentifier, data []byte) ([]byte, error)
Decrypt(parameter CryptoIdentifier, data []byte) ([]byte, error)
Sign(parameter CryptoIdentifier, data []byte) ([]byte, error)
GetKeys(parameter CryptoFilter) (*CryptoKeySet, error)
GetKey(parameter CryptoIdentifier) (*CryptoKey, error)
Verify(parameter CryptoIdentifier, data []byte, signature []byte) (bool, error)
GenerateKey(parameter CryptoKeyParameter) error
IsKeyExisting(parameter CryptoIdentifier) (bool, error)
DeleteKey(parameter CryptoIdentifier) error
RotateKey(parameter CryptoIdentifier) error
GetSupportedKeysAlgs() []KeyType
GetSupportedHashAlgs() []HashAlgorithm
}
Crypto Provider Interface Behavior:
1. Crypto Context must be created before use of any function. Funcs must return CryptoContext Error, when Context not initialized. 2. Crypto Context should be destroyed when Context is not more required.
type CryptoProviderModule ¶
type CryptoProviderModule interface {
GetCryptoProvider() CryptoProvider
}
type HashAlgorithm ¶
type HashAlgorithm string
const ( Sha2224 HashAlgorithm = "sha2-224" Sha2256 HashAlgorithm = "sha2-256" Sha2384 HashAlgorithm = "sha2-384" Sha2512 HashAlgorithm = "sha2-512" Sha3224 HashAlgorithm = "sha3-224" Sha3256 HashAlgorithm = "sha3-256" Sha3384 HashAlgorithm = "sha3-384" Sha3512 HashAlgorithm = "sha3-512" )
Click to show internal directories.
Click to hide internal directories.