Tabnine Logo
SSLUtils.getKeyManagers
Code IndexAdd Tabnine to your IDE (free)

How to use
getKeyManagers
method
in
com.sun.enterprise.security.ssl.SSLUtils

Best Java code snippets using com.sun.enterprise.security.ssl.SSLUtils.getKeyManagers (Showing top 14 results out of 315)

origin: org.glassfish.main.security/security

public KeyManager[] getKeyManagers() throws Exception{
  return getKeyManagers(null);
}
public KeyManager[] getKeyManagers(String algorithm) throws IOException,
origin: org.glassfish.security/security

public KeyManager[] getKeyManagers() throws Exception{
  return getKeyManagers(null);
}
public KeyManager[] getKeyManagers(String algorithm) throws IOException,
origin: org.glassfish.security/realms

public  CustomSocketFactory() {
  Habitat habitat = Globals.getDefaultHabitat();
  SSLUtils sslUtils = habitat.getComponent(SSLUtils.class);
  SSLContext sc = null;
  try {
    sc = SSLContext.getInstance(SSL);
    sc.init(sslUtils.getKeyManagers(), sslUtils.getTrustManagers(), new SecureRandom());
  } catch (Exception ex) {
    _logger.log(Level.WARNING, "security.exception", ex);
  }        
  socketFactory = sc.getSocketFactory();
}
 
origin: org.glassfish.main.security/security

public SSLContext getAdminSSLContext(String alias, String protocol) {
  try {
    if (protocol == null) {
      protocol = "TLS";
    }
    SSLContext cntxt = SSLContext.getInstance(protocol);
    KeyManager[] kMgrs = getKeyManagers();
    if (alias != null && alias.length() > 0 && kMgrs != null) {
      for (int i = 0; i < kMgrs.length; i++) {
        kMgrs[i] = new J2EEKeyManager((X509KeyManager)kMgrs[i], alias);
      }
    }
    cntxt.init(kMgrs, getTrustManagers(), null);
    return cntxt;
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}
origin: org.glassfish.security/security

@Override
protected KeyManager[] getKeyManagers(String algorithm, String keyAlias) throws Exception {
  if (sslUtils == null) {
    initSSLUtils();
  }
  String keystoreFile = (String) attributes.get("keystore");
  if (logger.isLoggable(Level.FINE)) {
    logger.log(Level.FINE, "Keystore file= {0}", keystoreFile);
  }
  String keystoreType = (String) attributes.get("keystoreType");
  if (logger.isLoggable(Level.FINE)) {
    logger.log(Level.FINE, "Keystore type= {0}", keystoreType);
  }
  KeyManager[] kMgrs = sslUtils.getKeyManagers(algorithm);
  if (keyAlias != null && keyAlias.length() > 0 && kMgrs != null) {
    for (int i = 0; i < kMgrs.length; i++) {
      kMgrs[i] = new J2EEKeyManager((X509KeyManager) kMgrs[i], keyAlias);
    }
  }
  return kMgrs;
}
origin: org.glassfish.security/security

public SSLContext getAdminSSLContext(String alias, String protocol) {
  try {
    if (protocol == null) {
      protocol = "TLS";
    }
    SSLContext cntxt = SSLContext.getInstance(protocol);
    KeyManager[] kMgrs = getKeyManagers();
    if (alias != null && alias.length() > 0 && kMgrs != null) {
      for (int i = 0; i < kMgrs.length; i++) {
        kMgrs[i] = new J2EEKeyManager((X509KeyManager)kMgrs[i], alias);
      }
    }
    cntxt.init(kMgrs, getTrustManagers(), null);
    return cntxt;
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}
origin: org.glassfish.main.security/security

@Override
protected KeyManager[] getKeyManagers(String algorithm, String keyAlias) throws Exception {
  if (sslUtils == null) {
    initSSLUtils();
  }
  String keystoreFile = (String) attributes.get("keystore");
  if (logger.isLoggable(Level.FINE)) {
    logger.log(Level.FINE, "Keystore file= {0}", keystoreFile);
  }
  String keystoreType = (String) attributes.get("keystoreType");
  if (logger.isLoggable(Level.FINE)) {
    logger.log(Level.FINE, "Keystore type= {0}", keystoreType);
  }
  KeyManager[] kMgrs = sslUtils.getKeyManagers(algorithm);
  if (keyAlias != null && keyAlias.length() > 0 && kMgrs != null) {
    for (int i = 0; i < kMgrs.length; i++) {
      kMgrs[i] = new J2EEKeyManager((X509KeyManager) kMgrs[i], keyAlias);
    }
  }
  return kMgrs;
}
origin: org.glassfish.main.security/security

public  CustomSocketFactory() {
  SSLUtils sslUtils = Globals.getDefaultHabitat().getService(SSLUtils.class);
  SSLContext sc = null;
  try {
    sc = SSLContext.getInstance(SSL);
    sc.init(sslUtils.getKeyManagers(), sslUtils.getTrustManagers(), SharedSecureRandom.get());
    socketFactory = sc.getSocketFactory();
  } catch (Exception ex) {
    _logger.log(Level.WARNING, SecurityLoggerInfo.securityExceptionError, ex);
  }        
}

origin: org.glassfish.security/security

public  CustomSocketFactory() {
  Habitat habitat = Globals.getDefaultHabitat();
  SSLUtils sslUtils = habitat.getComponent(SSLUtils.class);
  SSLContext sc = null;
  try {
    sc = SSLContext.getInstance(SSL);
    sc.init(sslUtils.getKeyManagers(), sslUtils.getTrustManagers(), SharedSecureRandom.get());
  } catch (Exception ex) {
    _logger.log(Level.WARNING, "security.exception", ex);
  }        
  socketFactory = sc.getSocketFactory();
}

origin: org.glassfish.main.security/security

SSLContext getSSLContext(String protocol, String algorithm, String trustAlgorithm) {
  try {
    //V3:Commented to break dependency on WebTier.
    //The SSLSocketFactory CTOR will now take care of setting the kmgr and tmgr
    //SSLSocketFactory.setManagers(getKeyManagers(), getTrustManagers());
    // Creating a default SSLContext and HttpsURLConnection for clients
    // that use Https
    if (protocol == null) {
      protocol = DEFAULT_SSL_PROTOCOL;
    }
    ctx = SSLContext.getInstance(protocol);
    String keyAlias = System.getProperty(HTTPS_OUTBOUND_KEY_ALIAS);
    KeyManager[] kMgrs = getKeyManagers(algorithm);
    if (keyAlias != null && keyAlias.length() > 0 && kMgrs != null) {
      for (int i = 0; i < kMgrs.length; i++) {
        kMgrs[i] = new J2EEKeyManager((X509KeyManager)kMgrs[i], keyAlias);
      }
    }
    ctx.init(kMgrs, getTrustManagers(trustAlgorithm), null);
    HttpsURLConnection.setDefaultSSLSocketFactory(ctx.getSocketFactory());
    //refer issue :http://java.net/jira/browse/GLASSFISH-15369
    SSLContext.setDefault(ctx);
  } catch (Exception e) {
    throw new Error(e);
  }
  return ctx;
}
origin: org.glassfish.security/security

SSLContext getSSLContext(String protocol, String algorithm, String trustAlgorithm) {
  try {
    //V3:Commented to break dependency on WebTier.
    //The SSLSocketFactory CTOR will now take care of setting the kmgr and tmgr
    //SSLSocketFactory.setManagers(getKeyManagers(), getTrustManagers());
    // Creating a default SSLContext and HttpsURLConnection for clients
    // that use Https
    if (protocol == null) {
      protocol = DEFAULT_SSL_PROTOCOL;
    }
    ctx = SSLContext.getInstance(protocol);
    String keyAlias = System.getProperty(HTTPS_OUTBOUND_KEY_ALIAS);
    KeyManager[] kMgrs = getKeyManagers(algorithm);
    if (keyAlias != null && keyAlias.length() > 0 && kMgrs != null) {
      for (int i = 0; i < kMgrs.length; i++) {
        kMgrs[i] = new J2EEKeyManager((X509KeyManager)kMgrs[i], keyAlias);
      }
    }
    ctx.init(kMgrs, getTrustManagers(trustAlgorithm), null);
    HttpsURLConnection.setDefaultSSLSocketFactory(ctx.getSocketFactory());
    //refer issue :http://java.net/jira/browse/GLASSFISH-15369
    SSLContext.setDefault(ctx);
  } catch (Exception e) {
    throw new Error(e);
  }
  return ctx;
}
origin: org.glassfish.main.security/ejb.security

public KeyManager[] getKeyManagers(String alias) {
  KeyManager[] mgrs = null;
  try {
    if (alias != null && !sslUtils.isTokenKeyAlias(alias)) {
      throw new IllegalStateException(getFormatMessage(
          "iiop.cannot_find_keyalias", new Object[]{alias}));
    }
    mgrs = sslUtils.getKeyManagers();
    if (alias != null && mgrs != null && mgrs.length > 0) {
      KeyManager[] newMgrs = new KeyManager[mgrs.length];
      for (int i = 0; i < mgrs.length; i++) {
        if (_logger.isLoggable(Level.FINE)) {
          StringBuffer msg = new StringBuffer("Setting J2EEKeyManager for ");
          msg.append(" alias : " + alias);
          _logger.log(Level.FINE, msg.toString());
        }
        newMgrs[i] = new J2EEKeyManager((X509KeyManager) mgrs[i], alias);
      }
      mgrs = newMgrs;
    }
  } catch (Exception e) {
    //TODO: log here
    throw new RuntimeException(e);
  }
  return mgrs;
}
public TrustManager[] getTrustManagers() {
origin: org.glassfish.main.security/websecurity

   public static synchronized void initStoresAtStartup()
  throws Exception
  {
    if (initialized) {
      return;
    }
    ServiceLocator habitat = Globals.getDefaultHabitat();
    SSLUtils sslUtils = habitat.getService(SSLUtils.class);

    keyManagers = sslUtils.getKeyManagers();
    trustManagers = sslUtils.getTrustManagers();
  
    // Creating a default SSLContext and HttpsURLConnection for clients 
    // that use Https
    SSLContext ctx = SSLContext.getInstance("TLS");
    String keyAlias = System.getProperty(SSLUtils.HTTPS_OUTBOUND_KEY_ALIAS);
    KeyManager[] kMgrs = sslUtils.getKeyManagers();
    if (keyAlias != null && keyAlias.length() > 0 && kMgrs != null) {
      for (int i = 0; i < kMgrs.length; i++) {
        kMgrs[i] = new J2EEKeyManager((X509KeyManager)kMgrs[i], keyAlias);
      }
    }
  ctx.init(kMgrs, sslUtils.getTrustManagers(), null);
    HttpsURLConnection.setDefaultSSLSocketFactory(ctx.getSocketFactory());
    initialized = true;
  }
}
origin: org.glassfish.security/securitycommon

KeyManager[] kMgrs = getKeyManagers();
if (keyAlias != null && keyAlias.length() > 0 && kMgrs != null) {
  for (int i = 0; i < kMgrs.length; i++) {
com.sun.enterprise.security.sslSSLUtilsgetKeyManagers

Popular methods of SSLUtils

  • getTrustManagers
  • <init>
  • checkPermission
  • getKeyStores
  • getSupportedCipherSuites
  • getTrustStores
  • mergingTrustStores
  • postConstruct
  • setAppclientSsl
  • getAdminSSLContext
  • getAdminSocketFactory
  • getKeyStore
  • getAdminSocketFactory,
  • getKeyStore,
  • getMergedTrustStore,
  • getPrivateKeyEntryFromTokenAlias,
  • getSSLContext,
  • getTrustStore,
  • verifyMasterPassword,
  • checkCertificateDates,
  • getKeyStorePass

Popular in Java

  • Finding current android device location
  • getResourceAsStream (ClassLoader)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • onCreateOptionsMenu (Activity)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • List (java.util)
    An ordered collection (also known as a sequence). The user of this interface has precise control ove
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • IsNull (org.hamcrest.core)
    Is the value null?
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Top plugins for Android Studio
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