2022-12-17 06:53:37 -06:00
|
|
|
package @APPID@;
|
2022-04-11 14:11:03 -05:00
|
|
|
|
|
|
|
import org.libsdl.app.SDLActivity;
|
2023-10-03 05:59:41 -05:00
|
|
|
import java.security.KeyStore;
|
|
|
|
import java.security.KeyStoreException;
|
|
|
|
import java.security.NoSuchAlgorithmException;
|
|
|
|
import java.util.Enumeration;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.util.Base64;
|
2022-04-11 14:11:03 -05:00
|
|
|
|
|
|
|
public class PowderActivity extends SDLActivity
|
|
|
|
{
|
2023-10-03 05:59:41 -05:00
|
|
|
public static String getCertificateBundle()
|
|
|
|
{
|
|
|
|
String allPems = "";
|
|
|
|
try {
|
|
|
|
KeyStore ks = KeyStore.getInstance("AndroidCAStore");
|
|
|
|
if (ks != null) {
|
|
|
|
ks.load(null, null);
|
|
|
|
Enumeration<String> aliases = ks.aliases();
|
|
|
|
while (aliases.hasMoreElements()) {
|
|
|
|
String alias = (String)aliases.nextElement();
|
|
|
|
java.security.cert.X509Certificate cert = (java.security.cert.X509Certificate)ks.getCertificate(alias);
|
|
|
|
allPems += "-----BEGIN CERTIFICATE-----\n" + Base64.getMimeEncoder().encodeToString(cert.getEncoded()) + "\n-----END CERTIFICATE-----\n";;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (IOException e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
return "";
|
|
|
|
} catch (KeyStoreException e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
return "";
|
|
|
|
} catch (NoSuchAlgorithmException e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
return "";
|
|
|
|
} catch (java.security.cert.CertificateException e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
return allPems;
|
|
|
|
}
|
2022-04-11 14:11:03 -05:00
|
|
|
}
|