Keys are changed because of concerns that you are hitting a point where 
collisions become more likely or you are changing keys because of concerns that 
the existing key is vulnerable or as part of you companies Security Processes. 
It's my understanding key rotation is usually a decrypt and re-encrypt 
exercise. The ability to rotate keys  should be taken into account for all 
EncryptionProvider implementations. What I need to do is create a KeyProvider 
interface so I can do something like wrap the KeyStore and then I could 
configure a list of aliases and assign a key so that an encrypted value can 
self identify which of the available keys it uses.

An ordered keyring. Then encryption is always done with the highest key on the 
chain.

-----Original Message-----
From: Antonio Sanso [mailto:[email protected]] 
Sent: Tuesday, November 21, 2017 5:37 AM
To: [email protected]
Subject: Re: value level encryption - Donating?

EXTERNAL

hi Jason,

I basically see 3 options:

* ship with AES/CBC that is ok but suboptimal
- ship with AES-GCM that is good but has the problem of the nonce highlighted 
before. The key rotation would help but than what do you do on rotation? 
Decrypt all the encrypted value and re-encrypt with the new key... ?
- Encrypt-than-MAC

I have also noted that the key is stored as OSGi configuration... This might 
also be part of a bigger discussion....

regards

antonio

On Nov 20, 2017, at 10:03 PM, Jason Bailey <[email protected]> wrote:

> It's all good. I  have less meetings today then I normally would and the 
> exercise was beneficial as it got me thinking about other potential vectors.
>
> Since the key for this is configurable via the OSGi console I would have 
> taken key rotation as being a business process exercise rather than a 
> technical one. But I don't mind changing it, I'm having a lot of fun with 
> this.
>
> To make sure I'm on the same page. The direction right now is 
> AES/CBC/PKCS5Padding but with encrypt and MAC?
>
> -----Original Message-----
> From: Antonio Sanso [mailto:[email protected]]
> Sent: Monday, November 20, 2017 3:07 PM
> To: [email protected]
> Subject: Re: value level encryption - Donating?
>
> EXTERNAL
>
> hi Jason,
>
> I get your point
> On Nov 20, 2017, at 4:57 PM, Jason Bailey <[email protected]> wrote:
>
>> Thanks Antonio. I had considered doing GCM, but I hesitated since it's not 
>> listed as a standard transformation that a Java platform must support. As I 
>> couldn't know what platform it would be running on I tried to be as much 
>> OOTB as possible. That desire to be OOTB is also why it's 128bit. My idea 
>> was to provide a generic level of encryption with the assumption that a 
>> downstream implementer would/should implement the EncryptionProvider service 
>> to the level of security their company requires.
>>
>> Saying that, if the desire is to have it GCM I will get that implemented.
>
> Thanks a lot taking this consideration and speed the implementation. You are 
> right about AES GCM. On top there is also another problem with it.
> AES GCM uses a nonce of 96 bits. It is vital important to never reuse the 
> same nonce with the same key otherwise the result is a real catastrophe 
> (cryptographically wise).
> This implies, given the birthday paradox, that we need to rotate the key 
> after 2^48 encryptions. This is a pretty big number but you know the life of 
> the key can be also long.
> Hence, without key rotation, it wouldn't probably good to ship with this (now 
> I am sorry you already jumped on it and implemented but I did not think you 
> were so fast).
>
> Another more conservative approach would be encrypt-than-mac (or we can 
> simply keep AES/CBC as default).
>
> An overall observation would be also that given the sensitive topic it would 
> be good to have a more extensive test suite for this feature...
>
> my 2 cents
>
> regards
>
> antonio
>

Reply via email to