From de6aefc61d6a79598a7bcecf8a8886cfc9c6f587 Mon Sep 17 00:00:00 2001
From: MrRare2 <mateo.jimenez0518@gmail.com>
Date: Fri, 14 Jun 2024 01:16:19 +0800
Subject: [PATCH] PackageManager: fixing things 3

---
 .../termux/api/apis/PackageManagerAPI.java    | 24 +++++++------------
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/app/src/main/java/com/termux/api/apis/PackageManagerAPI.java b/app/src/main/java/com/termux/api/apis/PackageManagerAPI.java
index 3b1b40bd..949bd510 100644
--- a/app/src/main/java/com/termux/api/apis/PackageManagerAPI.java
+++ b/app/src/main/java/com/termux/api/apis/PackageManagerAPI.java
@@ -109,14 +109,10 @@ public void writeJson(JsonWriter out) throws IOException {
                           CertificateFactory factory = CertificateFactory.getInstance("X.509");
                           X509Certificate cert = (X509Certificate) factory.generateCertificate(input);
                           out.name("sign_algorithm").value(cert.getSigAlgName());
-                          out.name("valid_from").value(cert.getNotBefore().getTime());
-                          out.name("valid_to").value(cert.getNotAfter().getTime());
-                          out.name("issuer_name").value(cert.getIssuerDN().getName());
-                          out.name("issuer_org").value(cert.getIssuerX500Principal().getName("O"));
-                          out.name("issuer_country").value(cert.getIssuerX500Principal().getName("C"));
-                          out.name("subject_name").value(cert.getSubjectDN().getName());
-                          out.name("subject_org").value(cert.getSubjectX500Principal().getName("O"));
-                          out.name("subject_country").value(cert.getSubjectX500Principal().getName("C"));
+                          out.name("valid_from").value(cert.getNotBefore().getTime()/1000);
+                          out.name("valid_to").value(cert.getNotAfter().getTime()/1000);
+                          out.name("issuer").value(cert.getIssuerDN().getName());
+                          out.name("subject").value(cert.getSubjectDN().getName());
                       } catch (CertificateException e) {}
                     }
                     out.endObject();
@@ -244,14 +240,10 @@ public void writeJson(JsonWriter out) throws IOException {
                             CertificateFactory factory = CertificateFactory.getInstance("X.509");
                             X509Certificate cert = (X509Certificate) factory.generateCertificate(input);
                             out.name("sign_algorithm").value(cert.getSigAlgName());
-                            out.name("valid_from").value(cert.getNotBefore().getTime());
-                            out.name("valid_to").value(cert.getNotAfter().getTime());
-                            out.name("issuer_name").value(cert.getIssuerDN().getName());
-                            out.name("issuer_org").value(cert.getIssuerX500Principal().getName("O"));
-                            out.name("issuer_country").value(cert.getIssuerX500Principal().getName("C"));
-                            out.name("subject_name").value(cert.getSubjectDN().getName());
-                            out.name("subject_org").value(cert.getSubjectX500Principal().getName("O"));
-                            out.name("subject_country").value(cert.getSubjectX500Principal().getName("C"));
+                            out.name("valid_from").value(cert.getNotBefore().getTime()/1000);
+                            out.name("valid_to").value(cert.getNotAfter().getTime()/1000);
+                            out.name("issuer").value(cert.getIssuerDN().getName());
+                            out.name("subject").value(cert.getSubjectDN().getName());
                         } catch (CertificateException e) {}
                     }
                     out.endObject();