/** * Get the KeyStore * * @param keyStoreFile * @param storePass * @return * @throws GeneralSecurityException * @throws IOException */ public static KeyStore getKeyStore(File keyStoreFile, char[] storePass) throws GeneralSecurityException, IOException { FileInputStream fis = new FileInputStream(keyStoreFile); return getKeyStore(fis, storePass); }
publicKey = KeyStoreUtil.getPublicKey(ks, domainAlias, this.keyStorePass.toCharArray()); } catch (UnrecoverableKeyException urke) { throw logger.keyStoreNullSigningKeyPass(); publicKey = KeyStoreUtil.getPublicKey(ks, domainAlias, this.signingKeyPass);
publicKey = KeyStoreUtil.getPublicKey(ks, domainAlias, this.keyStorePass.toCharArray()); } catch (UnrecoverableKeyException urke) { throw logger.keyStoreNullSigningKeyPass(); publicKey = KeyStoreUtil.getPublicKey(ks, domainAlias, this.signingKeyPass);
/** * Get the KeyStore * @param keyStoreFile * @param storePass * @return * @throws GeneralSecurityException * @throws IOException */ public static KeyStore getKeyStore(File keyStoreFile, char[] storePass) throws GeneralSecurityException, IOException { FileInputStream fis = new FileInputStream(keyStoreFile); return getKeyStore(fis, storePass); }
try publicKey = KeyStoreUtil.getPublicKey(ks, domainAlias, this.keyStorePass.toCharArray()); publicKey = KeyStoreUtil.getPublicKey(ks, domainAlias, this.signingKeyPass);
/** * Get the KeyStore * @param keyStoreFile * @param storePass * @return * @throws GeneralSecurityException * @throws IOException */ public static KeyStore getKeyStore(File keyStoreFile, char[] storePass) throws GeneralSecurityException, IOException { FileInputStream fis = new FileInputStream(keyStoreFile); return getKeyStore(fis, storePass); }
publicKey = KeyStoreUtil.getPublicKey(ks, domainAlias, this.keyStorePass.toCharArray()); } catch (UnrecoverableKeyException urke) { publicKey = KeyStoreUtil.getPublicKey(ks, domainAlias, this.signingKeyPass);
/** * Get the KeyStore * * @param keyStoreFile * @param storePass * * @return * * @throws GeneralSecurityException * @throws IOException */ public static KeyStore getKeyStore(File keyStoreFile, char[] storePass) throws GeneralSecurityException, IOException { FileInputStream fis = new FileInputStream(keyStoreFile); return getKeyStore(fis, storePass); }
try publicKey = KeyStoreUtil.getPublicKey(ks, domainAlias, this.keyStorePass.toCharArray()); publicKey = KeyStoreUtil.getPublicKey(ks, domainAlias, this.signingKeyPass);
/** * Get the KeyStore * * @param keyStoreFile * @param storePass * * @return * * @throws GeneralSecurityException * @throws IOException */ public static KeyStore getKeyStore(File keyStoreFile, char[] storePass) throws GeneralSecurityException, IOException { FileInputStream fis = new FileInputStream(keyStoreFile); return getKeyStore(fis, storePass); }
public KeyPair getSigningKeyPair() throws TrustKeyConfigurationException, TrustKeyProcessingException { try { initKeyStore(); PrivateKey privateKey = this.getSigningKey(); PublicKey publicKey = KeyStoreUtil.getPublicKey(this.ks, this.signingAlias, this.signingKeyPass); return new KeyPair(publicKey, privateKey); } catch (KeyStoreException e) { throw logger.keyStoreConfigurationError(e); } catch (GeneralSecurityException e) { throw logger.keyStoreProcessingError(e); } catch (IOException e) { throw logger.keyStoreProcessingError(e); } }
/** * Get the Keystore given the URL to the keystore * @param url * @param storePass * @return * @throws GeneralSecurityException * @throws IOException */ public static KeyStore getKeyStore(URL url, char[] storePass) throws GeneralSecurityException, IOException { if (url == null) throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "url"); return getKeyStore(url.openStream(), storePass); }
public KeyPair getSigningKeyPair() throws TrustKeyConfigurationException, TrustKeyProcessingException { try { if (this.ks == null) this.setUpKeyStore(); PrivateKey privateKey = this.getSigningKey(); PublicKey publicKey = KeyStoreUtil.getPublicKey(this.ks, this.signingAlias, this.signingKeyPass); return new KeyPair(publicKey, privateKey); } catch (KeyStoreException e) { throw new TrustKeyConfigurationException(e); } catch (GeneralSecurityException e) { throw new TrustKeyProcessingException(e); } catch (IOException e) { throw new TrustKeyProcessingException(e); } }
/** * Get the Keystore given the URL to the keystore * @param url * @param storePass * @return * @throws GeneralSecurityException * @throws IOException */ public static KeyStore getKeyStore(URL url, char[] storePass) throws GeneralSecurityException, IOException { if (url == null) throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "url"); return getKeyStore(url.openStream(), storePass); }
public KeyPair getSigningKeyPair() throws TrustKeyConfigurationException, TrustKeyProcessingException { if (this.signingKeyPass == null || this.signingKeyPass.length == 0) throw logger.keyStoreNullSigningKeyPass(); try { initKeyStore(); PrivateKey privateKey = this.getSigningKey(); PublicKey publicKey = KeyStoreUtil.getPublicKey(this.ks, this.signingAlias, this.signingKeyPass); return new KeyPair(publicKey, privateKey); } catch (KeyStoreException e) { throw logger.keyStoreConfigurationError(e); } catch (GeneralSecurityException e) { throw logger.keyStoreProcessingError(e); } catch (IOException e) { throw logger.keyStoreProcessingError(e); } }
/** * Get the Keystore given the url to the keystore file as a string * @param fileURL * @param storePass * @return * @throws GeneralSecurityException * @throws IOException */ public static KeyStore getKeyStore(String fileURL, char[] storePass) throws GeneralSecurityException, IOException { if (fileURL == null) throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "fileURL"); File file = new File(fileURL); FileInputStream fis = new FileInputStream(file); return getKeyStore(fis, storePass); }
public KeyPair getSigningKeyPair() throws TrustKeyConfigurationException, TrustKeyProcessingException { if (this.signingKeyPass == null || this.signingKeyPass.length == 0) throw logger.keyStoreNullSigningKeyPass(); try { initKeyStore(); PrivateKey privateKey = this.getSigningKey(); PublicKey publicKey = KeyStoreUtil.getPublicKey(this.ks, this.signingAlias, this.signingKeyPass); return new KeyPair(publicKey, privateKey); } catch (KeyStoreException e) { throw logger.keyStoreConfigurationError(e); } catch (GeneralSecurityException e) { throw logger.keyStoreProcessingError(e); } catch (IOException e) { throw logger.keyStoreProcessingError(e); } }
/** * Get the Keystore given the url to the keystore file as a string * @param fileURL * @param storePass * @return * @throws GeneralSecurityException * @throws IOException */ public static KeyStore getKeyStore(String fileURL, char[] storePass) throws GeneralSecurityException, IOException { if (fileURL == null) throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "fileURL"); File file = new File(fileURL); FileInputStream fis = new FileInputStream(file); return getKeyStore(fis, storePass); }
public KeyPair getSigningKeyPair() throws TrustKeyConfigurationException, TrustKeyProcessingException { try { if (this.ks == null) this.setUpKeyStore(); PrivateKey privateKey = this.getSigningKey(); PublicKey publicKey = KeyStoreUtil.getPublicKey(this.ks, this.signingAlias, this.signingKeyPass); return new KeyPair(publicKey, privateKey); } catch (KeyStoreException e) { throw new TrustKeyConfigurationException(e); } catch (GeneralSecurityException e) { throw new TrustKeyProcessingException(e); } catch (IOException e) { throw new TrustKeyProcessingException(e); } }
/** * Add a certificate to the KeyStore * @param keystoreFile * @param storePass * @param alias * @param cert * @throws GeneralSecurityException * @throws IOException */ public static void addCertificate(File keystoreFile, char[] storePass, String alias, Certificate cert) throws GeneralSecurityException, IOException { KeyStore keystore = getKeyStore(keystoreFile, storePass); // Add the certificate keystore.setCertificateEntry(alias, cert); // Save the new keystore contents FileOutputStream out = new FileOutputStream(keystoreFile); keystore.store(out, storePass); out.close(); } }