Shorten key by 2 bits.

This commit is contained in:
Brendan McMillion
2015-05-27 12:05:39 -07:00
committed by Brendan McMillion
parent e652300f43
commit 9e514e902a

View File

@@ -466,6 +466,11 @@ func (c *Cryptor) Encrypt(in []byte, labels []string, access AccessStructure) (r
if err != nil {
return
}
if len(access.Predicate) > 0 {
// The first two bits of the key need to be removed to prevent wrapping
// because the modulus is slightly too small.
clearKey[0] &= 63
}
err = encrypted.wrapKey(c.records, clearKey, access)
if err != nil {