Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Change cert create time to UTC #31705

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -1251,9 +1253,9 @@ public static byte[] createOperationalCertificate(
long nodeId,
List<Integer> 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,
Expand Down
Loading