Documentation ¶
Overview ¶
ThreatSpec package github.com/pki-io/core/document as document
ThreatSpec package github.com/pki-io/core/document as document
Index ¶
- Constants
- type Container
- func (doc *Container) Decrypt(id string, privateKey string) (string, error)
- func (doc *Container) Dump() string
- func (doc *Container) Encrypt(jsonString string, keys map[string]string) error
- func (doc *Container) IsEncrypted() bool
- func (doc *Container) IsSigned() bool
- func (doc *Container) SymmetricDecrypt(key string) (string, error)
- func (doc *Container) SymmetricEncrypt(jsonString, id, key string) error
- type ContainerData
- type Document
- type Documenter
Constants ¶
const ContainerDefault string = `` /* 271-byte string literal not displayed */
ContainerDefault sets default values for a Container.
const ContainerSchema string = `` /* 1909-byte string literal not displayed */
ContainerSchema defines the JSON schema for a Container.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Container ¶
type Container struct { Document Data ContainerData }
Container is a cryptographic document that can be signed and/or encrypted.
func NewContainer ¶
NewContainer creates a new Container.
func (*Container) Decrypt ¶
Decrypt takes a private key and decrypts the Container body, return a plaintext string.
func (*Container) Encrypt ¶
Encrypt takes a plaintext string and group encrypts for the given public keys and updates its data to the ciphertext and inputs.
func (*Container) IsEncrypted ¶
IsEncrypted checks whether the Container is encrypted.
func (*Container) SymmetricDecrypt ¶
SymmetricDecrypt takes a key and decrypts the Container body, returning a plaintext string.
func (*Container) SymmetricEncrypt ¶
SymmetricEncrypt takes a plaintext string and encrypts with the given key. It updates its data to the ciphertext and inputs.
type ContainerData ¶
type ContainerData struct { Scope string `json:"scope"` Version int `json:"version"` Type string `json:"type"` Options struct { Source string `json:"source"` SignatureMode string `json:"signature-mode"` SignatureInputs map[string]string `json:"signature-inputs"` Signature string `json:"signature"` EncryptionKeys map[string]string `json:"encryption-keys"` EncryptionMode string `json:"encryption-mode"` EncryptionInputs map[string]string `json:"encryption-inputs"` } `json:"options"` Body string `json:"body"` }
ContainerData stores the parsed JSON data.
type Document ¶
Documents represents a generic JSON schema based document
type Documenter ¶
type Documenter interface { Dump() Load() }