Documentation
¶
Overview ¶
storage defines a storage mechanism
storage implements a encrypted memory mechanism
Index ¶
- Variables
- func AESEncrypt(key []byte, message []byte) (string, error)
- func AppendMany(sep string, slices ...[]byte) []byte
- func ParseB64RSAPublicKeyFromPEM(pubPEM string) (*rsa.PublicKey, error)
- type CacheMetrics
- type CorrelationData
- type GetInteractionsFunc
- type Options
- type Storage
- type StorageDB
- func (s *StorageDB) AddInteraction(correlationID string, data []byte) error
- func (s *StorageDB) AddInteractionWithId(id string, data []byte) error
- func (s *StorageDB) Close() error
- func (s *StorageDB) GetCacheItem(token string) (*CorrelationData, error)
- func (s *StorageDB) GetCacheMetrics() (*CacheMetrics, error)
- func (s *StorageDB) GetInteractions(correlationID, secret string) ([]string, string, error)
- func (s *StorageDB) GetInteractionsWithId(id string) ([]string, error)
- func (s *StorageDB) OnCacheRemovalCallback(key cache.Key, value cache.Value)
- func (s *StorageDB) RemoveID(correlationID, secret string) error
- func (s *StorageDB) SetID(ID string) error
- func (s *StorageDB) SetIDPublicKey(correlationID, secretKey, publicKey string) error
Constants ¶
This section is empty.
Variables ¶
var DefaultOptions = Options{
MaxSize: 2500000,
}
var ErrCorrelationIdNotFound = errors.New("could not get correlation-id from cache")
Functions ¶
func AESEncrypt ¶ added in v1.0.7
AESEncrypt encrypts a message using AES and puts IV at the beginning of ciphertext.
func AppendMany ¶ added in v1.0.7
Types ¶
type CacheMetrics ¶ added in v0.0.5
type CorrelationData ¶
type CorrelationData struct { sync.Mutex // data contains data for a correlation-id in AES encrypted json format. Data []string `json:"data"` // secretkey is a secret key for original user verification SecretKey string `json:"-"` // AESKey is the AES encryption key in encrypted format. AESKeyEncrypted string `json:"aes-key"` // decrypted AES key for signing AESKey []byte `json:"-"` }
CorrelationData is the data for a correlation-id.
type GetInteractionsFunc ¶ added in v1.0.7
type GetInteractionsFunc func() []string
type Storage ¶
type Storage interface { GetCacheMetrics() (*CacheMetrics, error) SetIDPublicKey(correlationID, secretKey, publicKey string) error SetID(ID string) error AddInteraction(correlationID string, data []byte) error AddInteractionWithId(id string, data []byte) error GetInteractions(correlationID, secret string) ([]string, string, error) GetInteractionsWithId(id string) ([]string, error) RemoveID(correlationID, secret string) error GetCacheItem(token string) (*CorrelationData, error) Close() error }
type StorageDB ¶ added in v1.0.7
type StorageDB struct { Options *Options // contains filtered or unexported fields }
Storage is an storage for interactsh interaction data as well as correlation-id -> rsa-public-key data.
func (*StorageDB) AddInteraction ¶ added in v1.0.7
AddInteraction adds an interaction data to the correlation ID after encrypting it with Public Key for the provided correlation ID.
func (*StorageDB) AddInteractionWithId ¶ added in v1.0.7
AddInteractionWithId adds an interaction data to the id bucket
func (*StorageDB) GetCacheItem ¶ added in v1.0.7
func (s *StorageDB) GetCacheItem(token string) (*CorrelationData, error)
GetCacheItem returns an item as is
func (*StorageDB) GetCacheMetrics ¶ added in v1.0.7
func (s *StorageDB) GetCacheMetrics() (*CacheMetrics, error)
func (*StorageDB) GetInteractions ¶ added in v1.0.7
GetInteractions returns the interactions for a correlationID and removes it from the storage. It also returns AES Encrypted Key for the IDs.
func (*StorageDB) GetInteractionsWithId ¶ added in v1.0.7
GetInteractions returns the interactions for a id and empty the cache
func (*StorageDB) OnCacheRemovalCallback ¶ added in v1.0.7
func (*StorageDB) RemoveID ¶ added in v1.0.7
RemoveID removes data for a correlation ID and data related to it.
func (*StorageDB) SetIDPublicKey ¶ added in v1.0.7
SetIDPublicKey sets the correlation ID and publicKey into the cache for further operations.