Package ru.i_novus.common.sign.util
Class CryptoIO
- java.lang.Object
-
- ru.i_novus.common.sign.util.CryptoIO
-
public class CryptoIO extends Object
-
-
Method Summary
-
-
-
Method Detail
-
getInstance
public static CryptoIO getInstance()
-
readPkFromPKCS8
public PKCS8EncodedKeySpec readPkFromPKCS8(String keyPath)
-
readPrivateKey
public PrivateKey readPrivateKey(InputStream input) throws IOException, GeneralSecurityException
- Throws:
IOExceptionGeneralSecurityException
-
readPkFromPEM
public PrivateKey readPkFromPEM(Path keyPath, SignAlgorithmType algorithmType)
-
readCertFromDER
public org.bouncycastle.cert.X509CertificateHolder readCertFromDER(String crtPath)
-
readCertFromPEM
public X509Certificate readCertFromPEM(Path crtPath)
-
writeCertToDERFile
public String writeCertToDERFile(org.bouncycastle.cert.X509CertificateHolder certificateHolder, Path path)
-
writeCertToByteArray
public byte[] writeCertToByteArray(org.bouncycastle.cert.X509CertificateHolder certificateHolder)
-
writePKToByteArray
public byte[] writePKToByteArray(PrivateKey privateKey)
-
readPrivateKeyFromPKCS12
public PrivateKey readPrivateKeyFromPKCS12(Path filePath, String keystorePass)
-
getPkcs12KeyStore
public KeyStore getPkcs12KeyStore(InputStream inputStream, String keystorePass)
-
readPrivateKeyFromPKCS12
public PrivateKey readPrivateKeyFromPKCS12(KeyStore keyStore, String keystorePass)
-
readCertificateFromPKCS12
public X509Certificate readCertificateFromPKCS12(InputStream inputStream, String keystorePass)
-
readCertificateFromPKCS12
public X509Certificate readCertificateFromPKCS12(KeyStore keyStore)
-
readPrivateKeyFromPKCS12
public PrivateKey readPrivateKeyFromPKCS12(InputStream inputStream, String keystorePass)
-
readCertificateFromPKCS12
public X509Certificate readCertificateFromPKCS12(Path filePath, String keystorePass)
-
createPkcs12File
public void createPkcs12File(Path filePath, String password, PrivateKey privateKey, X509Certificate[] chain)
-
createPkcs12FileEncoded
public String createPkcs12FileEncoded(String password, PrivateKey privateKey, X509Certificate[] chain)
-
createPkcs12PfxPdu
public org.bouncycastle.pkcs.PKCS12PfxPdu createPkcs12PfxPdu(String password, PrivateKey privateKey, X509Certificate[] chain)
-
inputStreamToByteArray
public byte[] inputStreamToByteArray(InputStream inputStream)
Convert input stream to byte array using default buffer size- Parameters:
inputStream- input stream- Returns:
- byte array
-
inputStreamToByteArray
public byte[] inputStreamToByteArray(InputStream inputStream, int bufferSize) throws IOException
Convert input stream to byte array- Parameters:
inputStream- input streambufferSize- buffer size to process data- Returns:
- byte array
- Throws:
IOException
-
-