Package com.heroku.sdk
Class BasicKeyStore
- java.lang.Object
-
- com.heroku.sdk.BasicKeyStore
-
public class BasicKeyStore extends Object
This class is used to create a java.security.KeyStore from environment variables.- Author:
- Joe Kutner
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringDEFAULT_TYPE
-
Constructor Summary
Constructors Constructor Description BasicKeyStore(String cert, String password)BasicKeyStore(String key, String cert, String password)BasicKeyStore(String cert, String password, X509Certificate[] acceptedIssuers)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidasFile(Consumer<File> c)protected static KeyStorecreateKeyStore(Reader keyReader, Reader certReader, String password)protected static KeyStorecreateTrustStore(Reader certReader)protected static KeyStorecreateTrustStore(Reader certReader, X509Certificate[] acceptedIssuers)protected static PrivateKeygetPrivateKeyFromPEM(Reader keyReader)KeyStorekeyStore()protected static X509CertificateparseCert(org.bouncycastle.openssl.PEMParser parser)Stringpassword()voidstore(OutputStream out)voidstore(Path path)FilestoreTemp()byte[]toBytes()InputStreamtoInputStream()Stringtype()
-
-
-
Field Detail
-
DEFAULT_TYPE
protected static final String DEFAULT_TYPE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BasicKeyStore
public BasicKeyStore(String key, String cert, String password) throws CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException
-
BasicKeyStore
public BasicKeyStore(String cert, String password) throws CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException
-
BasicKeyStore
public BasicKeyStore(String cert, String password, X509Certificate[] acceptedIssuers) throws CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException
-
-
Method Detail
-
password
public String password()
-
keyStore
public KeyStore keyStore()
-
type
public String type()
-
toInputStream
public InputStream toInputStream() throws CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException
-
toBytes
public byte[] toBytes() throws CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException
-
store
public void store(OutputStream out) throws CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException
-
store
public void store(Path path) throws CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException
-
storeTemp
public File storeTemp() throws IOException, CertificateException, NoSuchAlgorithmException, KeyStoreException
-
asFile
public void asFile(Consumer<File> c) throws IOException, CertificateException, NoSuchAlgorithmException, KeyStoreException
-
createKeyStore
protected static KeyStore createKeyStore(Reader keyReader, Reader certReader, String password) throws IOException, CertificateException, KeyStoreException, NoSuchAlgorithmException
-
getPrivateKeyFromPEM
protected static PrivateKey getPrivateKeyFromPEM(Reader keyReader) throws IOException
- Throws:
IOException
-
createTrustStore
protected static KeyStore createTrustStore(Reader certReader) throws IOException, KeyStoreException, NoSuchAlgorithmException, CertificateException
-
createTrustStore
protected static KeyStore createTrustStore(Reader certReader, X509Certificate[] acceptedIssuers) throws IOException, KeyStoreException, NoSuchAlgorithmException, CertificateException
-
parseCert
protected static X509Certificate parseCert(org.bouncycastle.openssl.PEMParser parser) throws IOException, CertificateException
- Throws:
IOExceptionCertificateException
-
-