GenerateDataKey generates a new random data key and encrypts it with all MasterKeys.
()
| 650 | |
| 651 | // GenerateDataKey generates a new random data key and encrypts it with all MasterKeys. |
| 652 | func (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. |
| 662 | func (tree *Tree) GenerateDataKeyWithKeyServices(svcs []keyservice.KeyServiceClient) ([]byte, []error) { |
nothing calls this directly
no test coverage detected