aboutsummaryrefslogtreecommitdiff
path: root/actions/policy.go
diff options
context:
space:
mode:
authorJoe Richey joerichey@google.com <joerichey@google.com>2017-08-15 18:11:29 -0700
committerJoe Richey joerichey@google.com <joerichey@google.com>2017-08-17 22:49:44 -0700
commit151e8965fa3a9c8f65e316430f9df0fa763fb02d (patch)
tree5be6cb1e1d617e60ba7624abc3c940c65715ba5e /actions/policy.go
parentb4d51e0f4d34dbfd78e23662f3dfd90e86ae5e48 (diff)
cmd/fscrypt: purge command now clears cache
Diffstat (limited to 'actions/policy.go')
-rw-r--r--actions/policy.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/actions/policy.go b/actions/policy.go
index ceae573..bf1f593 100644
--- a/actions/policy.go
+++ b/actions/policy.go
@@ -29,6 +29,7 @@ import (
"github.com/google/fscrypt/crypto"
"github.com/google/fscrypt/filesystem"
"github.com/google/fscrypt/metadata"
+ "github.com/google/fscrypt/security"
"github.com/google/fscrypt/util"
)
@@ -56,10 +57,10 @@ func PurgeAllPolicies(ctx *Context) error {
for _, policyDescriptor := range policies {
service := ctx.getService()
- err = crypto.RemovePolicyKey(service + policyDescriptor)
+ err = security.RemoveKey(service + policyDescriptor)
switch errors.Cause(err) {
- case nil, crypto.ErrKeyringSearch:
+ case nil, security.ErrKeyringSearch:
// We don't care if the key has already been removed
default:
return err
@@ -365,7 +366,7 @@ func (policy *Policy) Apply(path string) error {
// IsProvisioned returns a boolean indicating if the policy has its key in the
// keyring, meaning files and directories using this policy are accessible.
func (policy *Policy) IsProvisioned() bool {
- _, err := crypto.FindPolicyKey(policy.Description())
+ _, err := security.FindKey(policy.Description())
return err == nil
}
@@ -381,7 +382,7 @@ func (policy *Policy) Provision() error {
// Deprovision removes the Policy key from the kernel keyring. This prevents
// reading and writing to the directory once the caches are cleared.
func (policy *Policy) Deprovision() error {
- return crypto.RemovePolicyKey(policy.Description())
+ return security.RemoveKey(policy.Description())
}
// commitData writes the Policy's current data to the filesystem.