Documentation ¶
Overview ¶
Copyright 2015 Gravitational, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
package encryptedbk implements encryption layer for any backend.
Copyright 2015 Gravitational, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2015 Gravitational, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- func KeyFromString(b64key string) (encryptor.Key, error)
- func KeyToString(key encryptor.Key) (string, error)
- func LoadKeyFromFile(filename string) (encryptor.Key, error)
- func SaveKeyToFile(key encryptor.Key, filename string) error
- type BoltKeyStore
- func (b *BoltKeyStore) AddKey(key encryptor.Key) error
- func (b *BoltKeyStore) Close()
- func (b *BoltKeyStore) DeleteKey(id string) error
- func (b *BoltKeyStore) GetKey(id string) (encryptor.Key, error)
- func (b *BoltKeyStore) GetKeys() ([]encryptor.Key, error)
- func (b *BoltKeyStore) HasKey(id string) bool
- type EncryptedBackend
- func (b *EncryptedBackend) AcquireLock(token string, ttl time.Duration) error
- func (b *EncryptedBackend) CompareAndSwap(path []string, key string, val []byte, ttl time.Duration, prevVal []byte) ([]byte, error)
- func (b *EncryptedBackend) DeleteAll() error
- func (b *EncryptedBackend) DeleteBucket(path []string, bkt string) error
- func (b *EncryptedBackend) DeleteKey(path []string, key string) error
- func (b *EncryptedBackend) GetKeys(path []string) ([]string, error)
- func (b *EncryptedBackend) GetVal(path []string, key string) ([]byte, error)
- func (b *EncryptedBackend) GetValAndTTL(path []string, key string) ([]byte, time.Duration, error)
- func (b *EncryptedBackend) ReleaseLock(token string) error
- func (b *EncryptedBackend) Sign() error
- func (b *EncryptedBackend) UpsertVal(path []string, key string, val []byte, ttl time.Duration) error
- func (b *EncryptedBackend) VerifySign() error
- type KeyStore
- type ReplicatedBackend
- func (b *ReplicatedBackend) AcquireLock(token string, ttl time.Duration) error
- func (b *ReplicatedBackend) AddSealKey(key encryptor.Key) error
- func (b *ReplicatedBackend) CompareAndSwap(path []string, key string, val []byte, ttl time.Duration, prevVal []byte) ([]byte, error)
- func (b *ReplicatedBackend) DeleteBucket(path []string, bkt string) error
- func (b *ReplicatedBackend) DeleteKey(path []string, key string) error
- func (b *ReplicatedBackend) DeleteSealKey(id string) error
- func (b *ReplicatedBackend) GenerateSealKey(name string) (encryptor.Key, error)
- func (b *ReplicatedBackend) GetKeys(path []string) ([]string, error)
- func (b *ReplicatedBackend) GetSealKey(id string) (encryptor.Key, error)
- func (b *ReplicatedBackend) GetSealKeys() ([]encryptor.Key, error)
- func (b *ReplicatedBackend) GetSignKey() (encryptor.Key, error)
- func (b *ReplicatedBackend) GetVal(path []string, key string) ([]byte, error)
- func (b *ReplicatedBackend) GetValAndTTL(path []string, key string) ([]byte, time.Duration, error)
- func (b *ReplicatedBackend) ReleaseLock(token string) error
- func (b *ReplicatedBackend) RewriteData() error
- func (b *ReplicatedBackend) SetSignKey(key encryptor.Key) error
- func (b *ReplicatedBackend) UpdateLocalKeysFromCluster() error
- func (b *ReplicatedBackend) UpsertVal(path []string, key string, val []byte, ttl time.Duration) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BoltKeyStore ¶
func NewKeyStore ¶
func NewKeyStore(filename string) (*BoltKeyStore, error)
func (*BoltKeyStore) Close ¶
func (b *BoltKeyStore) Close()
func (*BoltKeyStore) DeleteKey ¶
func (b *BoltKeyStore) DeleteKey(id string) error
func (*BoltKeyStore) HasKey ¶
func (b *BoltKeyStore) HasKey(id string) bool
type EncryptedBackend ¶
type EncryptedBackend struct { KeyID string // contains filtered or unexported fields }
func (*EncryptedBackend) AcquireLock ¶
func (b *EncryptedBackend) AcquireLock(token string, ttl time.Duration) error
func (*EncryptedBackend) CompareAndSwap ¶
func (*EncryptedBackend) DeleteAll ¶
func (b *EncryptedBackend) DeleteAll() error
func (*EncryptedBackend) DeleteBucket ¶
func (b *EncryptedBackend) DeleteBucket(path []string, bkt string) error
func (*EncryptedBackend) DeleteKey ¶
func (b *EncryptedBackend) DeleteKey(path []string, key string) error
func (*EncryptedBackend) GetKeys ¶
func (b *EncryptedBackend) GetKeys(path []string) ([]string, error)
func (*EncryptedBackend) GetVal ¶
func (b *EncryptedBackend) GetVal(path []string, key string) ([]byte, error)
func (*EncryptedBackend) GetValAndTTL ¶
func (*EncryptedBackend) ReleaseLock ¶
func (b *EncryptedBackend) ReleaseLock(token string) error
func (*EncryptedBackend) Sign ¶
func (b *EncryptedBackend) Sign() error
Add special value. Encrypted with public key and signed with private key.
func (*EncryptedBackend) VerifySign ¶
func (b *EncryptedBackend) VerifySign() error
Try to decrypt the special value and verify its sign.
type ReplicatedBackend ¶
type ReplicatedBackend struct {
// contains filtered or unexported fields
}
func NewReplicatedBackend ¶
func NewReplicatedBackend(backend backend.Backend, keysFile string, additionalKeys []encryptor.Key, keyGenerator encryptor.KeyGenerator) (*ReplicatedBackend, error)
func (*ReplicatedBackend) AcquireLock ¶
func (b *ReplicatedBackend) AcquireLock(token string, ttl time.Duration) error
func (*ReplicatedBackend) AddSealKey ¶
func (b *ReplicatedBackend) AddSealKey(key encryptor.Key) error
func (*ReplicatedBackend) CompareAndSwap ¶
func (*ReplicatedBackend) DeleteBucket ¶
func (b *ReplicatedBackend) DeleteBucket(path []string, bkt string) error
func (*ReplicatedBackend) DeleteKey ¶
func (b *ReplicatedBackend) DeleteKey(path []string, key string) error
func (*ReplicatedBackend) DeleteSealKey ¶
func (b *ReplicatedBackend) DeleteSealKey(id string) error
func (*ReplicatedBackend) GenerateSealKey ¶
func (b *ReplicatedBackend) GenerateSealKey(name string) (encryptor.Key, error)
func (*ReplicatedBackend) GetKeys ¶
func (b *ReplicatedBackend) GetKeys(path []string) ([]string, error)
func (*ReplicatedBackend) GetSealKey ¶
func (b *ReplicatedBackend) GetSealKey(id string) (encryptor.Key, error)
func (*ReplicatedBackend) GetSealKeys ¶
func (b *ReplicatedBackend) GetSealKeys() ([]encryptor.Key, error)
func (*ReplicatedBackend) GetSignKey ¶
func (b *ReplicatedBackend) GetSignKey() (encryptor.Key, error)
func (*ReplicatedBackend) GetVal ¶
func (b *ReplicatedBackend) GetVal(path []string, key string) ([]byte, error)
func (*ReplicatedBackend) GetValAndTTL ¶
func (*ReplicatedBackend) ReleaseLock ¶
func (b *ReplicatedBackend) ReleaseLock(token string) error
func (*ReplicatedBackend) RewriteData ¶
func (b *ReplicatedBackend) RewriteData() error
func (*ReplicatedBackend) SetSignKey ¶
func (b *ReplicatedBackend) SetSignKey(key encryptor.Key) error
func (*ReplicatedBackend) UpdateLocalKeysFromCluster ¶
func (b *ReplicatedBackend) UpdateLocalKeysFromCluster() error