Is deriving a key in a context equivalent to RFC2898 PBKDF2?

View: New views
2 Messages — Rating Filter:   Alert me  

Is deriving a key in a context equivalent to RFC2898 PBKDF2?

by Miller, Timothy J. :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I.e., if I did:

data = <some data encrypted under a PBKDF2 derived key>
ctx = cryptCreateContext(CRYPT_UNUSED, CRYPT_ALGO_3DES);
s = cryptSetAttribute(ctx, CRYPT_CTXINFO_IV, iv, sizeof(iv));
s = cryptSetAttribute(ctx, CRYPT_CTXINFO_KEYING_ITERATIONS, count);
s = cryptSetAttributeString(ctx, CRYPT_CTXINFO_KEYING_SALT, salt,
sizeof(salt));
s = cryptSetAttributeString(ctx, CRYPT_CTXINFO_KEYING_VALUE, password,
sizeof(password));
s = cryptDecrypt(ctx, data, sizeof(data));

Do I get the right plaintext?  :)

-- Tim



_______________________________________________
Cryptlib mailing list
Cryptlib@... via Mail: cryptlib-request@...
Archive: ftp://ftp.franken.de/pub/crypt/cryptlib/archives/
http://news.gmane.org/gmane.comp.encryption.cryptlib
Posts from non-subscribed addresses are blocked to prevent spam, please
subscribe in order to post messages.

smime.p7s (4K) Download Attachment

Re: Is deriving a key in a context equivalent to RFC2898 PBKDF2?

by Peter Gutmann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

"Timothy J. Miller" <tmiller@...> writes:

>I.e., if I did:
>
>data = <some data encrypted under a PBKDF2 derived key>
>ctx = cryptCreateContext(CRYPT_UNUSED, CRYPT_ALGO_3DES);
>s = cryptSetAttribute(ctx, CRYPT_CTXINFO_IV, iv, sizeof(iv));
>s = cryptSetAttribute(ctx, CRYPT_CTXINFO_KEYING_ITERATIONS, count);
>s = cryptSetAttributeString(ctx, CRYPT_CTXINFO_KEYING_SALT, salt, sizeof(salt));
>s = cryptSetAttributeString(ctx, CRYPT_CTXINFO_KEYING_VALUE, password, sizeof(password));
>s = cryptDecrypt(ctx, data, sizeof(data));
>
>Do I get the right plaintext?  :)

Yes, provided the values you're setting are the same as what was set when the
data was encrypted, that should give you the correct plaintext.

(Note that there's an easier way to do this, just use password-based
enveloping and the only thing you need to worry about is the password/key).

Peter.

_______________________________________________
Cryptlib mailing list
Cryptlib@... via Mail: cryptlib-request@...
Archive: ftp://ftp.franken.de/pub/crypt/cryptlib/archives/
http://news.gmane.org/gmane.comp.encryption.cryptlib
Posts from non-subscribed addresses are blocked to prevent spam, please
subscribe in order to post messages.