MCPcopy Index your code
hub / github.com/getsops/sops / GenerateDataKey

Method GenerateDataKey

sops.go:652–659  ·  view source on GitHub ↗

GenerateDataKey generates a new random data key and encrypts it with all MasterKeys.

()

Source from the content-addressed store, hash-verified

650
651// GenerateDataKey generates a new random data key and encrypts it with all MasterKeys.
652func (tree Tree) GenerateDataKey() ([]byte, []error) {
653 newKey := make([]byte, 32)
654 _, err := rand.Read(newKey)
655 if err != nil {
656 return nil, []error{fmt.Errorf("Could not generate random key: %s", err)}
657 }
658 return newKey, tree.Metadata.UpdateMasterKeys(newKey)
659}
660
661// GenerateDataKeyWithKeyServices generates a new random data key and encrypts it with all MasterKeys.
662func (tree *Tree) GenerateDataKeyWithKeyServices(svcs []keyservice.KeyServiceClient) ([]byte, []error) {

Callers

nothing calls this directly

Calls 1

UpdateMasterKeysMethod · 0.80

Tested by

no test coverage detected