X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=src%2Forg%2Fcacert%2Fgigi%2FGigiConfig.java;h=86738007eb237b6ccd66ee490e603b8e1068c59a;hb=6b985b637949909402c2e7be5e682b33d5e6abcd;hp=f8cf76378aa1f6539e6e18403b95fa77191c08bc;hpb=d690eda36eba121aa79e4f456d5f0eb481be8b86;p=gigi.git diff --git a/src/org/cacert/gigi/GigiConfig.java b/src/org/cacert/gigi/GigiConfig.java index f8cf7637..86738007 100644 --- a/src/org/cacert/gigi/GigiConfig.java +++ b/src/org/cacert/gigi/GigiConfig.java @@ -21,12 +21,15 @@ public class GigiConfig { private GigiConfig() { } + public byte[] getCacerts() { return cacerts; } + public byte[] getKeystore() { return keystore; } + public Properties getMainProps() { return mainProps; } @@ -53,6 +56,7 @@ public class GigiConfig { tis.close(); return gc; } + public static byte[] readFully(InputStream is) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; @@ -63,6 +67,7 @@ public class GigiConfig { baos.close(); return baos.toByteArray(); } + private static char[] transformSafe(byte[] readChunk) { char[] res = new char[readChunk.length]; for (int i = 0; i < res.length; i++) { @@ -72,18 +77,18 @@ public class GigiConfig { return res; } - public KeyStore getPrivateStore() throws GeneralSecurityException, - IOException { + public KeyStore getPrivateStore() throws GeneralSecurityException, IOException { KeyStore ks1 = KeyStore.getInstance("pkcs12"); ks1.load(new ByteArrayInputStream(keystore), keystorpw); return ks1; } - public KeyStore getTrustStore() throws GeneralSecurityException, - IOException { + + public KeyStore getTrustStore() throws GeneralSecurityException, IOException { KeyStore ks1 = KeyStore.getInstance("jks"); ks1.load(new ByteArrayInputStream(cacerts), truststorepw); return ks1; } + public String getPrivateStorePw() { return new String(keystorpw); }