Examples of KeyStoreManager


Examples of org.apache.karaf.jaas.config.KeystoreManager

        try {
            logger.debug("Setting up SSL");
            env.put(Context.SECURITY_PROTOCOL, "ssl");
            env.put("java.naming.ldap.factory.socket", ManagedSSLSocketFactory.class.getName());
            ref = bundleContext.getServiceReference(KeystoreManager.class.getName());
            KeystoreManager manager = (KeystoreManager) bundleContext.getService(ref);
            SSLSocketFactory factory = manager.createSSLFactory(sslProvider, sslProtocol, sslAlgorithm, sslKeystore, sslKeyAlias, sslTrustStore);
            ManagedSSLSocketFactory.setSocketFactory(factory);
            Thread.currentThread().setContextClassLoader(ManagedSSLSocketFactory.class.getClassLoader());
        } catch (Exception e) {
            throw new LoginException("Unable to setup SSL support for LDAP: " + e.getMessage());
        } finally {
View Full Code Here

Examples of org.apache.karaf.jaas.config.KeystoreManager

        try {
            logger.debug("Setting up SSL");
            env.put(Context.SECURITY_PROTOCOL, "ssl");
            env.put("java.naming.ldap.factory.socket", ManagedSSLSocketFactory.class.getName());
            ref = bundleContext.getServiceReference(KeystoreManager.class.getName());
            KeystoreManager manager = (KeystoreManager) bundleContext.getService(ref);
            SSLSocketFactory factory = manager.createSSLFactory(sslProvider, sslProtocol, sslAlgorithm, sslKeystore, sslKeyAlias, sslTrustStore);
            ManagedSSLSocketFactory.setSocketFactory(factory);
            Thread.currentThread().setContextClassLoader(ManagedSSLSocketFactory.class.getClassLoader());
        } catch (Exception e) {
            throw new LoginException("Unable to setup SSL support for LDAP: " + e.getMessage());
        } finally {
View Full Code Here

Examples of org.apache.karaf.jaas.config.KeystoreManager

        try {
            logger.debug("Setting up SSL");
            env.put(Context.SECURITY_PROTOCOL, "ssl");
            env.put("java.naming.ldap.factory.socket", ManagedSSLSocketFactory.class.getName());
            ref = bundleContext.getServiceReference(KeystoreManager.class.getName());
            KeystoreManager manager = (KeystoreManager) bundleContext.getService(ref);
            SSLSocketFactory factory = manager.createSSLFactory(sslProvider, sslProtocol, sslAlgorithm, sslKeystore, sslKeyAlias, sslTrustStore, sslTimeout);
            ManagedSSLSocketFactory.setSocketFactory(factory);
            Thread.currentThread().setContextClassLoader(ManagedSSLSocketFactory.class.getClassLoader());
        } catch (Exception e) {
            throw new LoginException("Unable to setup SSL support for LDAP: " + e.getMessage());
        } finally {
View Full Code Here

Examples of org.apache.manifoldcf.core.keystore.KeystoreManager

  /** Mint a keystore manager.
  */
  public static IKeystoreManager make(String passcode)
    throws ManifoldCFException
  {
    return new KeystoreManager(passcode);
  }
View Full Code Here

Examples of org.apache.servicemix.jbi.security.keystore.KeystoreManager

        currentHandler.set(this);
        if (context.getProperty(Context.AUTHENTICATION_SERVICE) != null) {
            setAuthenticationService((AuthenticationService) context.getProperty(Context.AUTHENTICATION_SERVICE));
        }
        if (crypto == null && context.getProperty(Context.KEYSTORE_MANAGER) != null) {
            KeystoreManager km = (KeystoreManager) context.getProperty(Context.KEYSTORE_MANAGER);
            setCrypto(new KeystoreInstanceCrypto(km, keystore));
        }
    }
View Full Code Here

Examples of org.apache.servicemix.jbi.security.keystore.KeystoreManager

        currentSubject.set(null);
        if (context.getProperty(Context.AUTHENTICATION_SERVICE) != null) {
            setAuthenticationService((AuthenticationService) context.getProperty(Context.AUTHENTICATION_SERVICE));
        }
        if (crypto == null && context.getProperty(Context.KEYSTORE_MANAGER) != null) {
            KeystoreManager km = (KeystoreManager) context.getProperty(Context.KEYSTORE_MANAGER);
            setCrypto(new KeystoreInstanceCrypto(km, keystore));
        }
    }
View Full Code Here

Examples of org.wso2.carbon.core.util.KeyStoreManager

            + RegistryResources.SERVICES + axisService.getName();

            Resource serviceResource = registry.get(servicePath);
            Association[] assoc = registry.getAssociations(servicePath, RegistryResources.Associations.PRIVATE_KEYSTORE);
           
            KeyStoreManager keyStoreManager = KeyStoreManager.getInstance(null);
           
            KeyStore keyStore = null;
            if(assoc.length < 1){

                boolean httpsEnabled = false;
                Association[] associations =
                    registry.getAssociations(servicePath, RegistryResources.Associations.EXPOSED_TRANSPORTS);
                for (Association association : associations) {
                    Resource resource = registry.get(association.getDestinationPath());
                    String transportProtocol = resource.getProperty(RegistryResources.Transports.PROTOCOL_NAME);
                    if(transportProtocol.equals("https")){
                        httpsEnabled = true;
                        break;
                    }
                    resource.discard();
                }
               
                if (httpsEnabled ||Boolean.valueOf(serviceResource.getProperty(RegistryResources.ServiceProperties.EXPOSED_ON_ALL_TANSPORTS))) {
                    keyStore = keyStoreManager.getPrimaryKeyStore();
                }
            } else {
                KeyStore ks = null;
                String kspath = assoc[0].getDestinationPath();
                if(kspath.equals(RegistryResources.SecurityManagement.PRIMARY_KEYSTORE_PHANTOM_RESOURCE)){
                    keyStore = keyStoreManager.getPrimaryKeyStore();
                }else{
                    String keyStoreName = kspath.substring(kspath.lastIndexOf("/")+1);
                    keyStore = keyStoreManager.getKeyStore(keyStoreName);
                }
            }
            serviceResource.discard();

            String alias = null;
View Full Code Here

Examples of org.wso2.carbon.core.util.KeyStoreManager

            new Integer(tenantId));
      }

            this.properties = prop;
           
            KeyStoreManager keyMan = KeyStoreManager.getInstance((UserRegistry)registry);
            String ksId = this.properties.getProperty(PROP_ID_PRIVATE_STORE);
            if(ksId != null){
                this.keystore = keyMan.getKeyStore(ksId);
            }
           
            // Get other keystores if available
            String trustStoreIds = this.properties.getProperty(PROP_ID_TRUST_STORES);
            if (trustStoreIds != null && trustStoreIds.trim().length() != 0) {
                String[] ids = trustStoreIds.trim().split(",");
                this.trustStores = new ArrayList(ids.length);
                for (int i = 0; i < ids.length; i++) {
                    String id = ids[i];
                    KeyStore tstks = keyMan.getKeyStore(id);
                    this.trustStores.add(i, tstks);
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
View Full Code Here

Examples of org.wso2.carbon.core.util.KeyStoreManager

  private SignKeyDataHolder() throws IdentityProviderException {
    // do once - because this is a expensive operation
    String keyAlias = null;
    KeyStoreAdmin keyAdmin = null;
    KeyStoreManager keyMan = null;
    Certificate[] certificates = null;

    try {

      keyAlias = ServerConfiguration.getInstance().getFirstProperty(
          "Security.KeyStore.KeyAlias");

      keyAdmin = new KeyStoreAdmin(IdentityTenantUtil.getRegistry(null,null));
      keyMan = KeyStoreManager.getInstance(null);

      issuerPK = (PrivateKey) keyAdmin.getPrivateKey(keyAlias);;
      certificates = keyMan.getPrimaryKeyStore().getCertificateChain(keyAlias);

      issuerCerts = new X509Certificate[certificates.length];

      int i = 0;
      for (Certificate certificate : certificates) {
View Full Code Here

Examples of org.wso2.carbon.core.util.KeyStoreManager

        String password = null;
        int tenantId = ((UserRegistry)registry).getTenantId();
        UserRegistry govRegistry = SecurityServiceHolder.getRegistryService().
                getGovernanceSystemRegistry(tenantId);
        try {
            KeyStoreManager keyMan = KeyStoreManager.getInstance(govRegistry);
            if (govRegistry.resourceExists(SecurityConstants.KEY_STORES)) {
                Collection collection = (Collection) govRegistry.get(SecurityConstants.KEY_STORES);
                String[] ks = collection.getChildren();

                for (int i = 0; i < ks.length; i++) {

                    String fullname = ks[i];
                    //get the primary keystore, only if it is super tenant.
                    if (tenantId == 0 && fullname
                            .equals(RegistryResources.SecurityManagement.PRIMARY_KEYSTORE_PHANTOM_RESOURCE)) {
                        KeyStore store = keyMan.getPrimaryKeyStore();
                        if (store.containsAlias(username)) {
                            password = keyMan.getPrimaryPrivateKeyPasssword();
                            break;
                        }
                    } else {
                        String name = fullname.substring(fullname.lastIndexOf("/") + 1);
                        KeyStore store = keyMan.getKeyStore(name);
                        if (store.containsAlias(username)) {
                            Resource resource = (Resource) govRegistry.get(ks[i]);
                            CryptoUtil cryptoUtil = CryptoUtil.getDefaultCryptoUtil();
                            String encryptedPassword = resource
                                    .getProperty(SecurityConstants.PROP_PRIVATE_KEY_PASS);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.