MCPcopy
hub / github.com/getsops/sops / EncryptIfNeeded

Method EncryptIfNeeded

hcvault/keysource.go:255–260  ·  view source on GitHub ↗

EncryptIfNeeded encrypts the provided SOPS data key, if it has not been encrypted yet.

(dataKey []byte)

Source from the content-addressed store, hash-verified

253// EncryptIfNeeded encrypts the provided SOPS data key, if it has not been
254// encrypted yet.
255func (key *MasterKey) EncryptIfNeeded(dataKey []byte) error {
256 if key.EncryptedKey == "" {
257 return key.Encrypt(dataKey)
258 }
259 return nil
260}
261
262// EncryptedDataKey returns the encrypted data key this master key holds.
263func (key *MasterKey) EncryptedDataKey() []byte {

Callers 1

Calls 1

EncryptMethod · 0.95

Tested by 1