[prev in list] [next in list] [prev in thread] [next in thread] 

List:       bouncycastle-crypto-dev
Subject:    Re: [dev-crypto] TimeStampTokenInfo.getGenTime() vs
From:       fulgerica fulgerica <fulgerica2003 () gmail ! com>
Date:       2009-09-25 8:35:46
Message-ID: 41e573e20909250135l769b041cp599d78cd65738e9f () mail ! gmail ! com
[Download RAW message or body]

Hello, David!

Yes, the problem is in the SimpleDateFormat, because it interprets the
fractions of seconds not as microseconds, but a miliseconds.

I also discovered that after submitting this bug to this mailing list
and looking into the sources of GeneralizedTime class.

The provided beta works just fine. I will open that bug at sun.

Thank you for help!

On Fri, Sep 25, 2009 at 8:04 AM, David Hook <dgh@lockboxlabs.com> wrote:
>
> The interesting thing about the difference is that 55:07 is 321 seconds
> after 49:46. It turns out that the Java date parser, SimpleDateFormat,
> which the BC GeneralisedTime class relies on, actually interprets
> everything after the decimal point as milliseconds, so .321849 is
> actually added to a date as 321.849 seconds.
>
> I, and probably many others, would be grateful if you filed this as a
> bug with Sun (a short example based on the input below is enough to show
> the problem). I've changed our GeneralisedTime class to truncate the
> field to 3 digits before passing it on to the parser.
>
> I've uploaded a beta to http://www.bouncycastle.org/betas with the work
> around.
>
> Let me know how it goes.
>
> Regards,
>
> David
>
> On Wed, 2009-09-23 at 11:02 +0300, fulgerica fulgerica wrote:
>> Hello everybody!
>>
>> Does anybody knows what iif between the values returned by the two
>> methods should be any difference?
>>
>> Let's say I have a timestamp obtained from a TSA. The timestamp object
>> is tsToken.
>>
>>
>> TimeStampToken tto = resp.getTimeStampToken();// resp is the response
>> from the TSA
>>
>> System.
>>
>> out.println("TS info gen time date: " +
>> tto.getTimeStampInfo().getGenTime());// this one prints TS info gen
>> time date: Wed Sep 23 10:55:07 EEST 2009
>>
>> System.
>>
>> out.println("TS info gen time encoded string: " +
>> tto.getTimeStampInfo().toTSTInfo().getGenTime().getTimeString());//
>> this one prints TS info gen time encoded string:
>> 20090923074946.321849Z
>>
>> System.
>>
>> out.println("TS info gen time encoded string: " +
>> tto.getTimeStampInfo().toTSTInfo().getGenTime().getTime());// this one
>> prints TS info gen time encoded string: 20090923074946.321849GMT
>> +00:00
>>
>>
>>
>> All informations are for the same timestamp. Can anyone tell me why
>> might be the difference between those values? I'm reffering to the
>> values itself, not the format. I mean the gen time says it's 10:55 and
>> the encoded value says that the time is 07:49.
>>
>> Apparently, the TimeStampTokenInfo.getGenTime() depends on the local
>> date/time settings. I have GMT+3, so the hour would be ok. But why do
>> I have different values at the minutes? Is that normal?
>>
>>
>>
>>
>>
>>
>>
>>
>
>

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic