]> git.apps.os.sepia.ceph.com Git - fscrypt.git/commit
crypto: secure key wrapping/unwrapping
authorJoe Richey <joerichey@google.com>
Thu, 2 Mar 2017 19:58:07 +0000 (11:58 -0800)
committerJoe Richey joerichey@google.com <joerichey@google.com>
Tue, 2 May 2017 20:39:18 +0000 (13:39 -0700)
commit8128b35375dfc4846dd1573dda55ef232ffd2d66
tree6f9eaf8651d9801424fa167cc168cabee8d191bf
parent8b09f614f9cc5038c71c6d75af6ab65071cca951
crypto: secure key wrapping/unwrapping

This commit adds in the ability to use the WrappedKeyData from the
metadata package to wrap and unwrap cryptographic keys of any length.
This makes use of several cryptographic primitives:
- Unsalted, SHA256-based HKDF for key stretching
- AES256 in CTR mode for encryption
- SHA256-based HMAC for authentication

Note that the key wrapping/unwrapping uses an "Encrypt then MAC" scheme
for doing authenticated unwrapping. This means we can detect if bogus
metadata has been given. This package also standardizes the length for
fscrypt's internal keys.

This CL is the first to add benchmarks, which can be run with:
go test -bench=. ./...

Change-Id: I2e5fc23a8a8cc36b17ccb3f26f03edcaccc517e1
crypto/crypto.go [new file with mode: 0644]
crypto/crypto_test.go
crypto/key.go