Documentation ¶
Overview ¶
ThreatSpec package github.com/pki-io/core/entity as entity
Index ¶
- Constants
- type Decrypter
- type Encrypter
- type Entity
- func (entity *Entity) Authenticate(container *document.Container, id, key string) error
- func (entity *Entity) AuthenticateString(content, id, key string) (*document.Container, error)
- func (entity *Entity) Body() EntityBody
- func (entity *Entity) Decrypt(container *document.Container) (string, error)
- func (entity *Entity) Dump() string
- func (entity *Entity) DumpPublic() string
- func (entity *Entity) Encrypt(content string, entities []Encrypter) (*document.Container, error)
- func (entity *Entity) EncryptThenAuthenticateString(content, id, key string) (*document.Container, error)
- func (entity *Entity) EncryptThenSignString(content string, entities []Encrypter) (*document.Container, error)
- func (entity *Entity) GenerateKeys() error
- func (entity *Entity) Id() string
- func (entity *Entity) Load(jsonString interface{}) error
- func (entity *Entity) Name() string
- func (entity *Entity) New(jsonString interface{}) error
- func (entity *Entity) Public() (*Entity, error)
- func (entity *Entity) Sign(container *document.Container) error
- func (entity *Entity) SignString(content string) (*document.Container, error)
- func (entity *Entity) SymmetricDecrypt(container *document.Container, key string) (string, error)
- func (entity *Entity) SymmetricEncrypt(content, id, key string) (*document.Container, error)
- func (entity *Entity) Verify(container *document.Container) error
- func (entity *Entity) VerifyAuthentication(container *document.Container, key string) error
- func (entity *Entity) VerifyAuthenticationThenDecrypt(container *document.Container, key string) (string, error)
- func (entity *Entity) VerifyThenDecrypt(container *document.Container) (string, error)
- type EntityBody
- type EntityData
Constants ¶
const EntityDefault string = `` /* 307-byte string literal not displayed */
EntityDefault provides default values for Entity.
const EntitySchema string = `` /* 1941-byte string literal not displayed */
EntitySchema defines the JSON Schema for Entity.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entity ¶
type Entity struct { document.Document Data EntityData }
Entity participates in cryptographic operations, sending and receiving secured data.
func (*Entity) Authenticate ¶
Authenticate takes a Container and MACs it using the provided key.
func (*Entity) AuthenticateString ¶
AuthenticateString takes a message string and key and MACs the message using the provided key.
func (*Entity) Body ¶
func (entity *Entity) Body() EntityBody
func (*Entity) Decrypt ¶
Decrypt takes a Container and decrypts the content using the entities private decryption key. It returns a plaintext string.
func (*Entity) DumpPublic ¶
DumpPublic serializes the public entity data, returning a JSON string.
func (*Entity) EncryptThenAuthenticateString ¶
func (entity *Entity) EncryptThenAuthenticateString(content, id, key string) (*document.Container, error)
EncryptThenAuthenticateString takes a plaintext string, encrypts it using the key and the MACs the ciphertext using they key.
Note: under the hood, the key is expanded into two separate keys, one for encryption and one for signing.
func (*Entity) EncryptThenSignString ¶
func (entity *Entity) EncryptThenSignString(content string, entities []Encrypter) (*document.Container, error)
EncryptThenSignString takes a plaintext string, encrypts it then signs the ciphertext.
func (*Entity) GenerateKeys ¶
GenerateKeys generates RSA or EC keys for the entity, depending on the KeyType set.
func (*Entity) SignString ¶
SignString takes a message string and signs it.
func (*Entity) SymmetricDecrypt ¶
SymmetricDecrypt takes a Container and decrypts the content using the provided key. It returns a plaintext string.
func (*Entity) SymmetricEncrypt ¶
SymmetricEncrypt takes a plaintext string and encrypts it with the given key.
func (*Entity) Verify ¶
Verify takes a Container and verifies the signature using the entities public key.
func (*Entity) VerifyAuthentication ¶
VerifyAuthentication takes a Container and verifies the MAC for the given key.
func (*Entity) VerifyAuthenticationThenDecrypt ¶
func (entity *Entity) VerifyAuthenticationThenDecrypt(container *document.Container, key string) (string, error)
VerifyAuthenticationThenDecrypt takes a container and verifies the MAC using the given key, then decrypts using the key, returning a plaintext string.
Note: under the hood, the key is expanded into two separate keys, one for encryption and one for signing.
type EntityBody ¶
type EntityBody struct { Id string `json:"id"` Name string `json:"name"` KeyType string `json:"key-type"` PublicSigningKey string `json:"public-signing-key"` PrivateSigningKey string `json:"private-signing-key"` PublicEncryptionKey string `json:"public-encryption-key"` PrivateEncryptionKey string `json:"private-encryption-key"` }
type EntityData ¶
type EntityData struct { Scope string `json:"scope"` Version int `json:"version"` Type string `json:"type"` Options string `json:"options"` Body EntityBody `json:"body"` }
EntityData represents parsed Entity JSON data.