On Fri, Dec 14, 2012 at 11:22 AM, Nikolay Elenkov
<[email protected]> wrote:
> On Fri, Dec 14, 2012 at 11:15 AM, Matthew Fleming <[email protected]> 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 <[email protected]>
>>> wrote:
>>> > I use the following code to encrypt a SecretKey with password-based
>>> > encryption:
>>> >
>>> > Cipher pbeEncryptCipher = Cipher.getInstance("PBEWithMD5AndDES");
>>>
>>> Try   Cipher.getInstance("PBEWithMD5AndDES", "BC");
>>
>>
>> This does not work. Also, I tried specifying several other PBE ciphers, and
>> ran into the same problem.
>>
>
> Can you share the stack trace?

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("PBKDF2WithHmacSHA1");
SecretKey key = keyFactory.generateSecret(keySpec);

And initialize the Cipher in WRAP mode with this SecretKey.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to