From 25145010d97ecc2e25c0498f3dcaf62cc60f06aa Mon Sep 17 00:00:00 2001 From: joonhaengHeo <85541460+joonhaengHeo@users.noreply.github.com> Date: Sat, 27 Jan 2024 02:32:46 +0900 Subject: [PATCH] [Android] Change cert create time to UTC (#31705) * Change cert create time to UTC * fix build error --- .../devicecontroller/ChipDeviceController.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/controller/java/src/chip/devicecontroller/ChipDeviceController.java b/src/controller/java/src/chip/devicecontroller/ChipDeviceController.java index 817a88c7d883ee..e4b59ac387429e 100644 --- a/src/controller/java/src/chip/devicecontroller/ChipDeviceController.java +++ b/src/controller/java/src/chip/devicecontroller/ChipDeviceController.java @@ -25,10 +25,12 @@ import chip.devicecontroller.model.ChipEventPath; import chip.devicecontroller.model.DataVersionFilter; import chip.devicecontroller.model.InvokeElement; +import java.time.ZoneOffset; import java.util.ArrayList; import java.util.Calendar; import java.util.List; import java.util.Optional; +import java.util.TimeZone; import javax.annotation.Nullable; /** Controller to interact with the CHIP device. */ @@ -1193,8 +1195,8 @@ public void invoke( public static byte[] createRootCertificate( KeypairDelegate keypair, long issuerId, @Nullable Long fabricId) { // current time - Calendar start = Calendar.getInstance(); - Calendar end = Calendar.getInstance(); + Calendar start = Calendar.getInstance(TimeZone.getTimeZone(ZoneOffset.UTC)); + Calendar end = Calendar.getInstance(TimeZone.getTimeZone(ZoneOffset.UTC)); // current time + 10 years end.add(Calendar.YEAR, 10); return createRootCertificate(keypair, issuerId, fabricId, start, end); @@ -1215,9 +1217,9 @@ public static byte[] createIntermediateCertificate( long issuerId, @Nullable Long fabricId) { // current time - Calendar start = Calendar.getInstance(); + Calendar start = Calendar.getInstance(TimeZone.getTimeZone(ZoneOffset.UTC)); // current time + 10 years - Calendar end = Calendar.getInstance(); + Calendar end = Calendar.getInstance(TimeZone.getTimeZone(ZoneOffset.UTC)); end.add(Calendar.YEAR, 10); return createIntermediateCertificate( rootKeypair, rootCertificate, intermediatePublicKey, issuerId, fabricId, start, end); @@ -1251,9 +1253,9 @@ public static byte[] createOperationalCertificate( long nodeId, List caseAuthenticatedTags) { // current time - Calendar start = Calendar.getInstance(); + Calendar start = Calendar.getInstance(TimeZone.getTimeZone(ZoneOffset.UTC)); // current time + 10 years - Calendar end = Calendar.getInstance(); + Calendar end = Calendar.getInstance(TimeZone.getTimeZone(ZoneOffset.UTC)); end.add(Calendar.YEAR, 10); return createOperationalCertificate( signingKeypair,