Tabnine Logo
KeyStoreHelper
Code IndexAdd Tabnine to your IDE (free)

How to use
KeyStoreHelper
in
com.helger.security.keystore

Best Java code snippets using com.helger.security.keystore.KeyStoreHelper (Showing top 20 results out of 315)

origin: com.helger/ph-security

/**
 * Load a key store from a resource.
 *
 * @param aKeyStoreType
 *        Type of key store. May not be <code>null</code>.
 * @param sKeyStorePath
 *        The path pointing to the key store. May not be <code>null</code>.
 * @param sKeyStorePassword
 *        The key store password. May be <code>null</code> to indicate that no
 *        password is required.
 * @return The Java key-store object.
 * @throws GeneralSecurityException
 *         In case of a key store error
 * @throws IOException
 *         In case key store loading fails
 * @throws IllegalArgumentException
 *         If the key store path is invalid
 */
@Nonnull
public static KeyStore loadKeyStoreDirect (@Nonnull final IKeyStoreType aKeyStoreType,
                      @Nonnull final String sKeyStorePath,
                      @Nullable final String sKeyStorePassword) throws GeneralSecurityException,
                                           IOException
{
 return loadKeyStoreDirect (aKeyStoreType,
               sKeyStorePath,
               sKeyStorePassword == null ? null : sKeyStorePassword.toCharArray ());
}
origin: phax/as2-lib

void load (@Nonnull InputStream aIS, @Nonnull char [] aPassword) throws OpenAS2Exception;
origin: com.helger/ph-security

/**
 * Load the specified secret key entry from the provided key store.
 *
 * @param aKeyStore
 *        The key store to load the key from. May not be <code>null</code>.
 * @param sKeyStorePath
 *        Key store path. For nice error messages only. May be
 *        <code>null</code>.
 * @param sKeyStoreKeyAlias
 *        The alias to be resolved in the key store. Must be non-
 *        <code>null</code> to succeed.
 * @param aKeyStoreKeyPassword
 *        The key password for the key store. Must be non-<code>null</code> to
 *        succeed.
 * @return The key loading result. Never <code>null</code>.
 */
@Nonnull
public static LoadedKey <KeyStore.SecretKeyEntry> loadSecretKey (@Nonnull final KeyStore aKeyStore,
                                 @Nonnull final String sKeyStorePath,
                                 @Nullable final String sKeyStoreKeyAlias,
                                 @Nullable final char [] aKeyStoreKeyPassword)
{
 return _loadKey (aKeyStore, sKeyStorePath, sKeyStoreKeyAlias, aKeyStoreKeyPassword, KeyStore.SecretKeyEntry.class);
}
origin: com.helger/ph-asic

final LoadedKeyStore aLKS = KeyStoreHelper.loadKeyStore (aKeyStoreType, sKeyStorePath, sKeyStorePassword);
if (aLKS.isFailure ())
 throw new IllegalStateException (aLKS.getErrorText (TextHelper.EN));
final LoadedKey <KeyStore.PrivateKeyEntry> aLK = KeyStoreHelper.loadPrivateKey (aLKS.getKeyStore (),
                                        sKeyStorePath,
                                        sKeyAlias,
origin: com.helger/peppol-directory-client

final LoadedKeyStore aLoadedKeyStore = KeyStoreHelper.loadKeyStore (PDClientConfiguration.getKeyStoreType (),
                                  PDClientConfiguration.getKeyStorePath (),
                                  PDClientConfiguration.getKeyStorePassword ());
 final LoadedKeyStore aLoadedTrustStore = KeyStoreHelper.loadKeyStore (PDClientConfiguration.getTrustStoreType (),
                                    PDClientConfiguration.getTrustStorePath (),
                                    PDClientConfiguration.getTrustStorePassword ());
origin: com.helger/ph-security

ValueEnforcer.notNull (sAliasToCopy, "AliasToCopy");
final KeyStore aKeyStore = getSimiliarKeyStore (aBaseKeyStore);
origin: com.helger/peppol-smp-server-library

final LoadedKeyStore aLoadedKeyStore = KeyStoreHelper.loadKeyStore (SMPServerConfiguration.getKeyStoreType (),
                                  SMPServerConfiguration.getKeyStorePath (),
                                  SMPServerConfiguration.getKeyStorePassword ());
final LoadedKey <KeyStore.PrivateKeyEntry> aLoadedKey = KeyStoreHelper.loadPrivateKey (m_aKeyStore,
                                            SMPServerConfiguration.getKeyStorePath (),
                                            SMPServerConfiguration.getKeyStoreKeyAlias (),
origin: com.helger/peppol-smp-server-library

private void _loadCertificates ()
{
 // Reset every time
 _setCertValid (false);
 _loadError (null, null);
 m_aTrustStore = null;
 // Load the trust store
 final LoadedKeyStore aTrustStoreLoading = KeyStoreHelper.loadKeyStore (SMPServerConfiguration.getTrustStoreType (),
                                     SMPServerConfiguration.getTrustStorePath (),
                                     SMPServerConfiguration.getTrustStorePassword ());
 if (aTrustStoreLoading.isFailure ())
 {
  _loadError (aTrustStoreLoading.getError (), PeppolKeyStoreHelper.getLoadError (aTrustStoreLoading));
  throw new InitializationException (s_sInitError);
 }
 m_aTrustStore = aTrustStoreLoading.getKeyStore ();
 LOGGER.info ("SMPTrustManager successfully initialized with truststore '" +
        SMPServerConfiguration.getTrustStorePath () +
        "'");
 _setCertValid (true);
}
origin: phax/peppol-smp-server

final LoadedKeyStore aLoadedKeyStore = KeyStoreHelper.loadKeyStore (SMPServerConfiguration.getKeyStoreType (),
                                  SMPServerConfiguration.getKeyStorePath (),
                                  SMPServerConfiguration.getKeyStorePassword ());
final LoadedKey <KeyStore.PrivateKeyEntry> aLoadedKey = KeyStoreHelper.loadPrivateKey (m_aKeyStore,
                                            SMPServerConfiguration.getKeyStorePath (),
                                            SMPServerConfiguration.getKeyStoreKeyAlias (),
origin: phax/peppol-smp-server

private void _loadCertificates ()
{
 // Reset every time
 _setCertValid (false);
 _loadError (null, null);
 m_aTrustStore = null;
 // Load the trust store
 final LoadedKeyStore aTrustStoreLoading = KeyStoreHelper.loadKeyStore (SMPServerConfiguration.getTrustStoreType (),
                                     SMPServerConfiguration.getTrustStorePath (),
                                     SMPServerConfiguration.getTrustStorePassword ());
 if (aTrustStoreLoading.isFailure ())
 {
  _loadError (aTrustStoreLoading.getError (), PeppolKeyStoreHelper.getLoadError (aTrustStoreLoading));
  throw new InitializationException (s_sInitError);
 }
 m_aTrustStore = aTrustStoreLoading.getKeyStore ();
 LOGGER.info ("SMPTrustManager successfully initialized with truststore '" +
        SMPServerConfiguration.getTrustStorePath () +
        "'");
 _setCertValid (true);
}
origin: com.helger/ph-security

aKeyStore = loadKeyStoreDirect (aKeyStoreType, sKeyStorePath, sKeyStorePassword);
origin: com.helger/ph-security

final InputStream aIS = getResourceProvider ().getInputStream (sKeyStorePath);
if (aIS == null)
 throw new IllegalArgumentException ("Failed to open key store '" + sKeyStorePath + "'");
origin: com.helger/ph-security

/**
 * Load the specified private key entry from the provided key store.
 *
 * @param aKeyStore
 *        The key store to load the key from. May not be <code>null</code>.
 * @param sKeyStorePath
 *        Key store path. For nice error messages only. May be
 *        <code>null</code>.
 * @param sKeyStoreKeyAlias
 *        The alias to be resolved in the key store. Must be non-
 *        <code>null</code> to succeed.
 * @param aKeyStoreKeyPassword
 *        The key password for the key store. Must be non-<code>null</code> to
 *        succeed.
 * @return The key loading result. Never <code>null</code>.
 */
@Nonnull
public static LoadedKey <KeyStore.PrivateKeyEntry> loadPrivateKey (@Nonnull final KeyStore aKeyStore,
                                  @Nonnull final String sKeyStorePath,
                                  @Nullable final String sKeyStoreKeyAlias,
                                  @Nullable final char [] aKeyStoreKeyPassword)
{
 return _loadKey (aKeyStore, sKeyStorePath, sKeyStoreKeyAlias, aKeyStoreKeyPassword, KeyStore.PrivateKeyEntry.class);
}
origin: phax/peppol-smp-server

final String sKeyStorePath = PDClientConfiguration.getKeyStorePath ();
final LoadedKeyStore aKeyStoreLR = KeyStoreHelper.loadKeyStore (eKeyStoreType,
                                sKeyStorePath,
                                PDClientConfiguration.getKeyStorePassword ());
 final LoadedKey <KeyStore.PrivateKeyEntry> aKeyLoading = KeyStoreHelper.loadPrivateKey (aKeyStore,
                                             sKeyStorePath,
                                             sKeyStoreAlias,
origin: com.helger/peppol-smp-server-webapp

        new HCDiv ().addChild ("A connection to the " + sDirectoryName + " server cannot be establised!"));
final LoadedKeyStore aLoadedKeyStore = KeyStoreHelper.loadKeyStore (PDClientConfiguration.getKeyStoreType (),
                                  PDClientConfiguration.getKeyStorePath (),
                                  PDClientConfiguration.getKeyStorePassword ());
origin: com.helger/peppol-smp-client

m_aKeyStore = KeyStoreHelper.loadKeyStoreDirect (m_eTruststoreType,
                         m_sTruststorePath,
                         m_sTrustStorePassword);
origin: com.helger/ph-security

 /**
  * Load the specified private key entry from the provided key store.
  *
  * @param aKeyStore
  *        The key store to load the key from. May not be <code>null</code>.
  * @param sKeyStorePath
  *        Key store path. For nice error messages only. May be
  *        <code>null</code>.
  * @param sKeyStoreKeyAlias
  *        The alias to be resolved in the key store. Must be non-
  *        <code>null</code> to succeed.
  * @param aKeyStoreKeyPassword
  *        The key password for the key store. Must be non-<code>null</code> to
  *        succeed.
  * @return The key loading result. Never <code>null</code>.
  */
 @Nonnull
 public static LoadedKey <KeyStore.TrustedCertificateEntry> loadTrustedCertificateKey (@Nonnull final KeyStore aKeyStore,
                                            @Nonnull final String sKeyStorePath,
                                            @Nullable final String sKeyStoreKeyAlias,
                                            @Nullable final char [] aKeyStoreKeyPassword)
 {
  return _loadKey (aKeyStore,
           sKeyStorePath,
           sKeyStoreKeyAlias,
           aKeyStoreKeyPassword,
           KeyStore.TrustedCertificateEntry.class);
 }
}
origin: com.helger/peppol-smp-server-webapp

final String sKeyStorePath = PDClientConfiguration.getKeyStorePath ();
final LoadedKeyStore aKeyStoreLR = KeyStoreHelper.loadKeyStore (eKeyStoreType,
                                sKeyStorePath,
                                PDClientConfiguration.getKeyStorePassword ());
 final LoadedKey <KeyStore.PrivateKeyEntry> aKeyLoading = KeyStoreHelper.loadPrivateKey (aKeyStore,
                                             sKeyStorePath,
                                             sKeyStoreAlias,
origin: phax/peppol-smp-server

        new HCDiv ().addChild ("A connection to the " + sDirectoryName + " server cannot be establised!"));
final LoadedKeyStore aLoadedKeyStore = KeyStoreHelper.loadKeyStore (PDClientConfiguration.getKeyStoreType (),
                                  PDClientConfiguration.getKeyStorePath (),
                                  PDClientConfiguration.getKeyStorePassword ());
origin: com.helger/peppol-directory-indexer

try
 final KeyStore aKS = KeyStoreHelper.loadKeyStoreDirect (aTS.getType (), aTS.getPath (), aTS.getPassword ());
 aCert = (X509Certificate) aKS.getCertificate (aTS.getAlias ());
com.helger.security.keystoreKeyStoreHelper

Javadoc

Helper methods to access Java key stores of type JKS (Java KeyStore).

Most used methods

  • loadKeyStore
    Load the provided key store in a safe manner.
  • loadKeyStoreDirect
    Load a key store from a resource.
  • loadPrivateKey
    Load the specified private key entry from the provided key store.
  • getResourceProvider
  • _loadKey
  • getSimiliarKeyStore

Popular in Java

  • Making http requests using okhttp
  • onCreateOptionsMenu (Activity)
  • getResourceAsStream (ClassLoader)
  • startActivity (Activity)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now