aboutsummaryrefslogtreecommitdiffstats
path: root/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java
diff options
context:
space:
mode:
authorAshley Hughes <spirit.returned@gmail.com>2014-01-30 11:35:55 +0000
committerAshley Hughes <spirit.returned@gmail.com>2014-01-30 11:35:55 +0000
commit4119757699083889c8288960c7581a3060bd60c1 (patch)
treea5f665065feafaa40511d4f7641fc2f6cdea473c /OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java
parent358ab7d7e44314acc4659809e6f7a3e8b78b532b (diff)
downloadopen-keychain-4119757699083889c8288960c7581a3060bd60c1.tar.gz
open-keychain-4119757699083889c8288960c7581a3060bd60c1.tar.bz2
open-keychain-4119757699083889c8288960c7581a3060bd60c1.zip
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
Diffstat (limited to 'OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java')
-rw-r--r--OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java
index eed0ed256..d6f130682 100644
--- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java
+++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java
@@ -28,6 +28,7 @@ import java.security.SignatureException;
import java.util.ArrayList;
import java.util.Date;
import java.util.GregorianCalendar;
+import java.util.TimeZone;
import org.spongycastle.bcpg.CompressionAlgorithmTags;
import org.spongycastle.bcpg.HashAlgorithmTags;
@@ -323,7 +324,7 @@ public class PgpKeyOperation {
hashedPacketsGen.setPreferredCompressionAlgorithms(true, PREFERRED_COMPRESSION_ALGORITHMS);
if (keysExpiryDates.get(0) != null) {
- GregorianCalendar creationDate = new GregorianCalendar();
+ GregorianCalendar creationDate = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
creationDate.setTime(masterPublicKey.getCreationTime());
GregorianCalendar expiryDate = keysExpiryDates.get(0);
//note that the below, (a/c) - (b/c) is *not* the same as (a - b) /c
@@ -402,7 +403,7 @@ public class PgpKeyOperation {
hashedPacketsGen.setKeyFlags(false, keyFlags);
if (keysExpiryDates.get(i) != null) {
- GregorianCalendar creationDate = new GregorianCalendar();
+ GregorianCalendar creationDate = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
creationDate.setTime(subPublicKey.getCreationTime());
GregorianCalendar expiryDate = keysExpiryDates.get(i);
//note that the below, (a/c) - (b/c) is *not* the same as (a - b) /c