Codota Logo
KeyStoreHelper
Code IndexAdd Codota 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)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ScheduledThreadPoolExecutor s =
  • Codota Iconnew ScheduledThreadPoolExecutor(corePoolSize)
  • Codota IconThreadFactory threadFactory;new ScheduledThreadPoolExecutor(corePoolSize, threadFactory)
  • Codota IconString str;new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder().setNameFormat(str).build())
  • Smart code suggestions by Codota
}
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

  • Parsing JSON documents to java classes using gson
  • getContentResolver (Context)
  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • addToBackStack (FragmentTransaction)
  • ObjectMapper (com.fasterxml.jackson.databind)
    This mapper (or, data binder, or codec) provides functionality for converting between Java objects (
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • TreeMap (java.util)
    A Red-Black tree based NavigableMap implementation. The map is sorted according to the Comparable of
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • JFileChooser (javax.swing)
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now