dbarstis has asked for the wisdom of the Perl Monks concerning the following question:
A 3rd party vendor wants us to send HTML data that includes a generated token. I'm in way over my head here and am desperately in need of help since they want it now.
The token contains:
a. The encryption key version number. In case the key is changed later.
b. A random number
c. The time the token was generated (in seconds)
d. The identity of the user. This is the employee ID for that user (ie. 912345678).
e. A computed check byte that can be used to verify the token hasn’t been tampered with.
The generated token is encrypted with the shared encryption key. The key has already been generated and shared.
The token layout:
Byte Description
index
0 Version number of the layout of this token. The version number inside of the token should match the plaintext version number in the HTML form
1..4 A random number.
5..8 The creation time of this token, which must be within a short window of time when the token is consumed. The timestamp is an unsigned 32-bit count of time since January 1, 1970 UTC (standard for time in the java api). The acceptable time window is 2 minutes by default, but may be adjusted by mutual agreement.
9..12 The identity of the user as a 32 bit unsigned number. (This can be the organizations employee id).
13 A check byte computed from the exclusive-or (“xor”) of all the previous bytes of the token. The service provider must verify that this field matches the value computed by the service provider against all the previous bytes in this token
Encryption details
Encryption is performed with the following parameters:
a. AES algorithm
b. ECB mode
c. PKCS#5 padding
d. 128-bit (16 byte) key
Encoding to hexadecimal characters is performed such that the byte at index 0 is encoded to the first character pair of the hex string, with successive bytes at higher indexes encoding into successive characters.
If anyone is up to the challenge, I would be forever grateful. Any and all help is appreciated.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: pack and AES help needed
by AnomalousMonk (Archbishop) on Sep 21, 2011 at 16:12 UTC | |
|
Re: pack and AES help needed
by zentara (Cardinal) on Sep 21, 2011 at 16:23 UTC | |
|
Re: pack and AES help needed
by onelesd (Pilgrim) on Sep 21, 2011 at 17:50 UTC | |
|
Re: pack and AES help needed
by Anonymous Monk on Sep 21, 2011 at 21:11 UTC | |
|
Re: pack and AES help needed
by dbarstis (Novice) on Sep 22, 2011 at 13:24 UTC | |
|
Re: pack and AES help needed
by dbarstis (Novice) on Sep 29, 2011 at 21:32 UTC |