Documentation
¶
Index ¶
- Constants
- func AddWithEncryption(id string, exp int, object interface{}, connection Bucket, ...) (bool, error)
- func AddWithSignature(id string, exp int, object interface{}, connection Bucket, ...) (bool, error)
- func ArmorDecode(reader io.Reader) (io.Reader, error)
- func ArmorEncoder(writer io.Writer) (io.WriteCloser, error)
- func Decrypt(reader io.Reader, secertKeyring openpgp.EntityList) (io.ReadCloser, error)
- func Encrypt(reader io.Reader, writer io.Writer, publicKeyRing openpgp.EntityList) error
- func GetWithEncryption(id string, object interface{}, connection Bucket, provider SecurityProvider) error
- func GetWithSignature(id string, object interface{}, connection Bucket, provider SecurityProvider) error
- func IsNotFoundError(err error) bool
- func SetWithEncryption(id string, exp uint32, object interface{}, connection Bucket, ...) error
- func SetWithSignature(id string, exp uint32, object interface{}, connection Bucket, ...) error
- func Sign(reader io.Reader, writer io.Writer, privateKeyring openpgp.EntityList) error
- func SignDetached(reader io.Reader, writer io.Writer, privateKeyring openpgp.EntityList) error
- func Verify(signed io.Reader, publicKeyRing openpgp.EntityList) ([]byte, error)
- func VerifyDetached(signed, signature io.Reader, publicKeyRing openpgp.EntityList) error
- type Bucket
- type EncryptedData
- type OpenPGPSecurityProvider
- func (p *OpenPGPSecurityProvider) Decrypt(reader io.Reader) (io.ReadCloser, error)
- func (p *OpenPGPSecurityProvider) Encrypt(reader io.Reader, writer io.Writer) error
- func (p *OpenPGPSecurityProvider) Sign(reader io.Reader, writer io.Writer) error
- func (p *OpenPGPSecurityProvider) SignDetached(reader io.Reader, writer io.Writer) error
- func (p *OpenPGPSecurityProvider) Verify(signed io.Reader) ([]byte, error)
- func (p *OpenPGPSecurityProvider) VerifyDetached(signed, signature io.Reader) error
- type ProtectedDataRead
- type ProtectedDataSet
- type SecurityProvider
Constants ¶
const NotFound string = "Not found"
NotFound error string returned from couchbase when a key cannot be found
Variables ¶
This section is empty.
Functions ¶
func AddWithEncryption ¶
func AddWithEncryption(id string, exp int, object interface{}, connection Bucket, provider SecurityProvider) (bool, error)
AddWithEncryption encrypts data before sending it to couchbase
func AddWithSignature ¶
func AddWithSignature(id string, exp int, object interface{}, connection Bucket, provider SecurityProvider) (bool, error)
AddWithSignature signs json structure before putting it in couchbase
func ArmorDecode ¶
ArmorDecode decodes a preivously encoded armor encoded stream
func ArmorEncoder ¶
func ArmorEncoder(writer io.Writer) (io.WriteCloser, error)
ArmorEncoder encodes to a text friendly format
func Decrypt ¶
func Decrypt(reader io.Reader, secertKeyring openpgp.EntityList) (io.ReadCloser, error)
Decrypt decrypts data that has been encrypted and compressed
func Encrypt ¶
Encrypt compresses data and then encrypts it data is encrypted with all public keys found in the supplied keyring.
func GetWithEncryption ¶
func GetWithEncryption(id string, object interface{}, connection Bucket, provider SecurityProvider) error
GetWithEncryption decrypts encrypted data given a key in couchbase
func GetWithSignature ¶
func GetWithSignature(id string, object interface{}, connection Bucket, provider SecurityProvider) error
GetWithSignature verifys a json object with a detached signature
func IsNotFoundError ¶
IsNotFoundError checks if we get a key not found error from couchbase
func SetWithEncryption ¶
func SetWithEncryption(id string, exp uint32, object interface{}, connection Bucket, provider SecurityProvider) error
SetWithEncryption encrypts data before sending it to couchbase
func SetWithSignature ¶
func SetWithSignature(id string, exp uint32, object interface{}, connection Bucket, provider SecurityProvider) error
SetWithSignature signs json structure before putting it in couchbase
func SignDetached ¶
SignDetached signs data and writes the raw signature to the writer
func Verify ¶
Verify reads a clear signed message returning the body of the messages after verification has been successful
func VerifyDetached ¶
func VerifyDetached(signed, signature io.Reader, publicKeyRing openpgp.EntityList) error
VerifyDetached verifies a seperate signature against a source
Types ¶
type Bucket ¶
type Bucket interface { Get(k string, rv interface{}) (gocb.Cas, error) Counter(key string, delta, initial int64, expiry uint32) (uint64, gocb.Cas, error) Upsert(string, interface{}, uint32) (gocb.Cas, error) // Add(k string, exp int, v interface{}) (bool, error) SetAdd(key string, value interface{}, createSet bool) (gocb.Cas, error) Remove(key string, cas gocb.Cas) (gocb.Cas, error) }
Bucket an interface for go-couchbase bucket
type EncryptedData ¶
type EncryptedData struct {
EncryptedAndSigned []byte
}
EncryptedData a container for encrypted and signed data
type OpenPGPSecurityProvider ¶
type OpenPGPSecurityProvider struct {
// contains filtered or unexported fields
}
OpenPGPSecurityProvider is a OpenPGP implementation of the security provider interface
func NewOpenPGPSecurityProvider ¶
func NewOpenPGPSecurityProvider(privateKeyRingReader, publicKeyRingReader io.Reader) (*OpenPGPSecurityProvider, error)
NewOpenPGPSecurityProvider creates a new OpenPGPSecurityProvider given a private and public key ring
func (*OpenPGPSecurityProvider) Decrypt ¶
func (p *OpenPGPSecurityProvider) Decrypt(reader io.Reader) (io.ReadCloser, error)
Decrypt decrypts the contents of a reader
func (*OpenPGPSecurityProvider) Sign ¶
Sign signs the contents of a reader and writes the signature to the writer
func (*OpenPGPSecurityProvider) SignDetached ¶
SignDetached signs the contents of a reader and writes the detached signature to the writer
func (*OpenPGPSecurityProvider) Verify ¶
func (p *OpenPGPSecurityProvider) Verify(signed io.Reader) ([]byte, error)
Verify validates a reader with signature within the contents of the reader
func (*OpenPGPSecurityProvider) VerifyDetached ¶
func (p *OpenPGPSecurityProvider) VerifyDetached(signed, signature io.Reader) error
VerifyDetached validates the contents of signed with a seperate signature
type ProtectedDataRead ¶
type ProtectedDataRead struct { Data json.RawMessage Signature []byte }
ProtectedDataRead a json.RawMessage wrapper for protected data
type ProtectedDataSet ¶
type ProtectedDataSet struct { Data interface{} Signature []byte }
ProtectedDataSet a container for signed data
type SecurityProvider ¶
type SecurityProvider interface { Decrypt(reader io.Reader) (io.ReadCloser, error) Encrypt(reader io.Reader, writer io.Writer) error Sign(reader io.Reader, writer io.Writer) error SignDetached(reader io.Reader, writer io.Writer) error Verify(signed io.Reader) ([]byte, error) VerifyDetached(signed, signature io.Reader) error }
SecurityProvider is an interface around encryption and verification implementations