bouncycastle uses the Date class, based off of UTC. Force all GregorianCalendars to use UTC, so get and set of key dates works as expected

This commit is contained in:
Ashley Hughes
2014-01-30 11:35:55 +00:00
parent 358ab7d7e4
commit 4119757699
4 changed files with 15 additions and 27 deletions

View File

@@ -29,6 +29,7 @@ import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -182,8 +183,11 @@ public class HkpKeyServer extends KeyServer {
info.keyId = PgpKeyHelper.convertHexToKeyId(matcher.group(3));
info.fingerPrint = PgpKeyHelper.convertKeyIdToHex(info.keyId);
String chunks[] = matcher.group(4).split("-");
info.date = new GregorianCalendar(Integer.parseInt(chunks[0]),
Integer.parseInt(chunks[1]), Integer.parseInt(chunks[2])).getTime();
GregorianCalendar tmpGreg = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
tmpGreg.set(Integer.parseInt(chunks[0]), Integer.parseInt(chunks[1]),
Integer.parseInt(chunks[2]));
info.date = tmpGreg.getTime();
info.userIds = new ArrayList<String>();
if (matcher.group(5).startsWith("*** KEY")) {
info.revoked = matcher.group(5);