List of usage examples for java.lang ClassLoader getResourceAsStream
public InputStream getResourceAsStream(String name)
From source file:com.aqnote.shared.cryptology.cert.loader.CaCertLoader.java
public synchronized static KeyPair getClass2CaKeyPair() throws IOException { if (class2CaKeyPair == null) { ClassLoader classLoader = ClassLoaderUtil.getClassLoader(); InputStream is = classLoader.getResourceAsStream(CLASS2_CA_KEY_FILE); class2CaKeyPair = PKCSReader.readKeyPair(is, null); is.close();/*from w w w . j a va2 s .c o m*/ } return class2CaKeyPair; }
From source file:com.aqnote.shared.cryptology.cert.loader.CaCertLoader.java
public synchronized static KeyPair getClass2CaKeyPair(char[] pwd) throws IOException { if (class2CaKeyPair == null) { ClassLoader classLoader = ClassLoaderUtil.getClassLoader(); InputStream is = classLoader.getResourceAsStream(CLASS2_CA_KEY_FILE); class2CaKeyPair = PKCSReader.readKeyPair(is, pwd); is.close();// w w w .ja v a 2s .c om } return class2CaKeyPair; }
From source file:com.aqnote.shared.cryptology.cert.loader.CaCertLoader.java
public synchronized static X509Certificate getClass3CaCert() throws IOException { if (class3RootCert == null) { ClassLoader classLoader = ClassLoaderUtil.getClassLoader(); InputStream is = classLoader.getResourceAsStream(CLASS_3_CA_Cert_FILE); class3RootCert = PKCSReader.readCert(is); is.close();/*from w w w .j a va2 s . c om*/ } return class3RootCert; }
From source file:com.aqnote.shared.cryptology.cert.loader.CaCertLoader.java
public synchronized static KeyPair getClass3CaKeyPair() throws IOException { if (class3RootKeyPair == null) { ClassLoader classLoader = ClassLoaderUtil.getClassLoader(); InputStream is = classLoader.getResourceAsStream(CLASS_3_CA_KEY_FILE); class3RootKeyPair = PKCSReader.readKeyPair(is, null); is.close();/*from w ww . ja va2s .c o m*/ } return class3RootKeyPair; }
From source file:com.aqnote.shared.cryptology.cert.loader.CaCertLoader.java
public synchronized static KeyPair getClass3CaKeyPair(char[] pwd) throws IOException { if (class3RootKeyPair == null) { ClassLoader classLoader = ClassLoaderUtil.getClassLoader(); InputStream is = classLoader.getResourceAsStream(CLASS_3_CA_KEY_FILE); class3RootKeyPair = PKCSReader.readKeyPair(is, pwd); is.close();//from w w w . j ava 2 s . c o m } return class3RootKeyPair; }
From source file:com.aqnote.shared.cryptology.cert.loader.CaCertLoader.java
public synchronized static String getB64RootCaCert() throws IOException { if (StringUtils.isBlank(b64RootCaCert)) { ClassLoader classLoader = ClassLoaderUtil.getClassLoader(); InputStream is = classLoader.getResourceAsStream(CA_Cert_FILE); b64RootCaCert = StreamUtil.stream2Bytes(is, StandardCharsets.UTF_8); b64RootCaCert = StringUtils.removeStart(b64RootCaCert, BEGIN_CERT); b64RootCaCert = StringUtils.removeEnd(b64RootCaCert, END_CERT); }// w w w. j a v a 2 s .co m return b64RootCaCert; }
From source file:jchat.test.RestTest.java
private static void copyFile(String name) { final ClassLoader ctxCl = Thread.currentThread().getContextClassLoader(); try {// w w w . j av a 2 s . com FileUtils.copyInputStreamToFile(ctxCl.getResourceAsStream("test/" + name), new File(System.getProperty("arquillian.tomee.path") + "/conf/" + name)); } catch (Exception e) { throw new RuntimeException(e); } }
From source file:com.aqnote.shared.encrypt.cert.bc.loader.CaCertLoader.java
public synchronized static X509Certificate getCaCrt() throws IOException { if (caCrt == null) { ClassLoader classLoader = ClassLoaderUtil.getClassLoader(); InputStream is = classLoader.getResourceAsStream(CA_CRT_FILE); caCrt = PKCSReader.readCert(is); is.close();/*w w w . ja v a 2s. c om*/ } return caCrt; }
From source file:com.aqnote.shared.encrypt.cert.bc.loader.CaCertLoader.java
public synchronized static KeyPair getCaKeyPair() throws IOException { if (caKeyPair == null) { ClassLoader classLoader = ClassLoaderUtil.getClassLoader(); InputStream is = classLoader.getResourceAsStream(CA_KEY_FILE); caKeyPair = PKCSReader.readKeyPair(is, null); is.close();//from w w w . j a va2 s . c o m } return caKeyPair; }
From source file:com.aqnote.shared.encrypt.cert.bc.loader.CaCertLoader.java
public synchronized static KeyPair getCaKeyPair(char[] pwd) throws IOException { if (caKeyPair == null) { ClassLoader classLoader = ClassLoaderUtil.getClassLoader(); InputStream is = classLoader.getResourceAsStream(CA_KEY_FILE); caKeyPair = PKCSReader.readKeyPair(is, pwd); is.close();/*ww w.j av a 2 s . c om*/ } return caKeyPair; }