On Mon, Dec 17, 2012 at 8:59 AM, Matthew Fleming wrote:
> Got it. The problem was that I had replaced
>
> byte[] keyBytes = keyFactory.generateSecret(keySpec).getEncoded();
>
> SecretKey key = new SecretKeySpec(keyBytes, "AES");
>
>
> with
>
>
> SecretKey key = keyFactory.generateSecret(keySpec);
Got it. The problem was that I had replaced
byte[] keyBytes = keyFactory.generateSecret(keySpec).getEncoded();
SecretKey key = new SecretKeySpec(keyBytes, "AES");
with
SecretKey key = keyFactory.generateSecret(keySpec);
This is not a problem for the generic version of the Bouncy Castle
pro
Thanks very much. Using your code and a few other bits and pieces, I've
come up with this, which generates a SecretKey for AES and then wraps it
using PBE:
KeyGenerator generator = KeyGenerator.getInstance("AES");
generator.init(128);
Key keyToBeWrapped = generator.generateKey();
Log.v("
On Mon, Dec 17, 2012 at 1:57 AM, Matthew Fleming wrote:
> Thanks very much. I had pretty much reached the same conclusion -- that I
> should just try switching to encryption/decryption rather than wrap/unwrap,
> and this works. I have included a complete example, below, which works on
> Android 4.
Thanks very much. I had pretty much reached the same conclusion -- that I
should just try switching to encryption/decryption rather than wrap/unwrap,
and this works. I have included a complete example, below, which works on
Android 4.2, 4.1, and presumably earlier versions.
Actually I developed
On Sat, Dec 15, 2012 at 12:17 PM, Matthew Fleming wrote:
>>
>> You can also try deriving the wrap key separately with something like:
>>
>> KeySpec keySpec = new PBEKeySpec(password.toCharArray(), salt,
>> ITERATION_COUNT, KEY_LENGTH);
>> SecretKeyFactory keyFactory = SecretKe
does this help?
http://stackoverflow.com/questions/13433529/android-4-2-broke-my-encrypt-decrypt-code-and-the-provided-solutions-dont-work
On Saturday, December 15, 2012 5:17:05 AM UTC+2, Matthew Fleming wrote:
>
>
>> You can also try deriving the wrap key separately with something like:
>>
>>
>
>
> You can also try deriving the wrap key separately with something like:
>
> KeySpec keySpec = new PBEKeySpec(password.toCharArray(), salt,
> ITERATION_COUNT, KEY_LENGTH);
> SecretKeyFactory keyFactory = SecretKeyFactory
> .getInstance("PBKDF2WithHm
On Fri, Dec 14, 2012 at 11:22 AM, Nikolay Elenkov
wrote:
> On Fri, Dec 14, 2012 at 11:15 AM, Matthew Fleming wrote:
>>
>>
>> On Wednesday, December 12, 2012 11:21:10 PM UTC-6, Nikolay Elenkov wrote:
>>>
>>> On Thu, Dec 13, 2012 at 11:55 AM, Matthew Fleming
>>> wrote:
>>> > I use the following co
On Fri, Dec 14, 2012 at 11:15 AM, Matthew Fleming wrote:
>
>
> On Wednesday, December 12, 2012 11:21:10 PM UTC-6, Nikolay Elenkov wrote:
>>
>> On Thu, Dec 13, 2012 at 11:55 AM, Matthew Fleming
>> wrote:
>> > I use the following code to encrypt a SecretKey with password-based
>> > encryption:
>> >
On Wednesday, December 12, 2012 11:21:10 PM UTC-6, Nikolay Elenkov wrote:
>
> On Thu, Dec 13, 2012 at 11:55 AM, Matthew Fleming
> >
> wrote:
> > I use the following code to encrypt a SecretKey with password-based
> > encryption:
> >
> > Cipher pbeEncryptCipher = Cipher.getInstance("PBEWithM
On Thu, Dec 13, 2012 at 11:55 AM, Matthew Fleming wrote:
> I use the following code to encrypt a SecretKey with password-based
> encryption:
>
> Cipher pbeEncryptCipher = Cipher.getInstance("PBEWithMD5AndDES");
Try Cipher.getInstance("PBEWithMD5AndDES", "BC");
Also probably not a good idea to
I use the following code to encrypt a SecretKey with password-based
encryption:
Cipher pbeEncryptCipher = Cipher.getInstance("PBEWithMD5AndDES");
pbeEncryptCipher.init(Cipher.WRAP_MODE, pbeKey, pbeParamSpec);
byte[] symKeyBytes = null;
try {
symKeyBytes = pbeEncryp
13 matches
Mail list logo