Examples of KeyStoreAdmin


Examples of org.wso2.carbon.security.keystore.KeyStoreAdmin

        return dbMan.getAllUserTrusteddRelyingParties(getRegsitry(), user);
    }

    public void createUserTrustedRelyingParty(String userName, String hostName, String content)
            throws IdentityProviderException, IdentityException, CarbonException {
        KeyStoreAdmin keyAdmin = null;
        UserTrustedRPDO rpdo = null;
        String storeFilePath = null;

        storeFilePath = IdentityUtil
                .getProperty(IdentityConstants.ServerConfig.USER_TRUSTED_RP_STORE_LOCATION);
        try {
            keyAdmin = new KeyStoreAdmin(
                    IdentityTenantUtil.getRegistryService().getGovernanceSystemRegistry());
            if (hostName == null) {
                hostName = keyAdmin.importCertToStore(content, new File(storeFilePath).getName());
            } else {
                keyAdmin.importCertToStore(hostName, content, new File(storeFilePath).getName());
            }
        } catch (Exception e) {
            throw new IdentityProviderException(e.getMessage(), e);
        }
View Full Code Here

Examples of org.wso2.carbon.security.keystore.KeyStoreAdmin

     * @throws IdentityException
     */
    public void removeUserTrustedRelyingParty(String user, String hostName)
            throws IdentityProviderException, IdentityException, CarbonException {
        String storeFilePath = null;
        KeyStoreAdmin keyAdmin = null;
        UserTrustedRPDO rpdo = null;

        storeFilePath = IdentityUtil
                .getProperty(IdentityConstants.ServerConfig.USER_TRUSTED_RP_STORE_LOCATION);

        rpdo = new UserTrustedRPDO();
        rpdo.setHostName(hostName);
        rpdo.setUserId(user);
        dbMan.removeUserTrustedRelyingParty(getRegsitry(), rpdo);
        try {
            keyAdmin = new KeyStoreAdmin(IdentityTenantUtil.getRegistryService().getGovernanceSystemRegistry());
            keyAdmin.removeCertFromStore(hostName, new File(storeFilePath).getName());
        } catch (SecurityConfigException e) {
            throw new IdentityProviderException(e.getMessage(), e);
        } catch (RegistryException e) {
            throw new IdentityProviderException(e.getMessage(), e);
        }
View Full Code Here

Examples of org.wso2.carbon.security.keystore.KeyStoreAdmin

     * @return
     * @throws IdentityException
     */
    protected X509Certificate getCertificateFromUserTrustedRP(String alias)
            throws IdentityException {
        KeyStoreAdmin keyAdmin = null;
        String storeFilePath = null;
        KeyStoreData keyStoreData = null;
        CertData[] certs = null;

        try {
            storeFilePath = IdentityUtil
                    .getProperty(IdentityConstants.ServerConfig.USER_TRUSTED_RP_STORE_LOCATION);
            keyAdmin = new KeyStoreAdmin(IdentityTenantUtil.getRegistry(null, null));
            keyAdmin.setIncludeCert(true);
            keyStoreData = keyAdmin.getKeystoreInfo(new File(storeFilePath).getName());
            certs = keyStoreData.getCerts();

            for (CertData certData : certs) {
                if (certData.getAlias().equals(alias)) {
                    return ((CertDataDetail) certData).getCertificate();
View Full Code Here

Examples of org.wso2.carbon.security.keystore.KeyStoreAdmin

  }

  private void addKeyStores() throws SecurityConfigException, RegistryException, IdentityException {
    String storeFilePath = null;
    KeyStoreAdmin keyAdmin = null;
    String password = null;
    String type = null;
    String privateKeyPass = null;

    storeFilePath = IdentityUtil
        .getProperty(IdentityConstants.ServerConfig.USER_TRUSTED_RP_STORE_LOCATION);
    password = IdentityUtil
        .getProperty(IdentityConstants.ServerConfig.USER_TRUSTED_RP_STORE_PASSWORD);
    type = IdentityUtil.getProperty(IdentityConstants.ServerConfig.USER_TRUSTED_RP_STORE_TYPE);
    privateKeyPass = IdentityUtil
        .getProperty(IdentityConstants.ServerConfig.USER_TRUSTED_RP_KEY_PASSWORD);

    keyAdmin = new KeyStoreAdmin(IdentityProviderServiceComponent.getRegistryService().
                                    getGovernanceSystemRegistry());
    keyAdmin.addKeyStoreWithFilePath(storeFilePath, new File(storeFilePath).getName(),
        password, "", type, privateKeyPass);
  }
View Full Code Here

Examples of org.wso2.carbon.security.keystore.KeyStoreAdmin

        password, "", type, privateKeyPass);
  }

    private void addSSOKeyStores() throws SecurityConfigException, RegistryException, IdentityException {
    String storeFilePath = null;
    KeyStoreAdmin keyAdmin = null;
    String password = null;
    String type = null;
    String privateKeyPass = null;

    storeFilePath = IdentityUtil
        .getProperty(IdentityConstants.ServerConfig.USER_SSO_STORE_LOCATION);
    password = IdentityUtil
        .getProperty(IdentityConstants.ServerConfig.USER_SSO_STORE_PASSWORD);
    type = IdentityUtil.getProperty(IdentityConstants.ServerConfig.USER_SSO_STORE_TYPE);
    privateKeyPass = IdentityUtil
        .getProperty(IdentityConstants.ServerConfig.USER_SSO_KEY_PASSWORD);

    keyAdmin = new KeyStoreAdmin(IdentityProviderServiceComponent.getRegistryService().
                                    getGovernanceSystemRegistry());
    keyAdmin.addKeyStoreWithFilePath(storeFilePath, new File(storeFilePath).getName(),
        password, "", type, privateKeyPass);
  }
View Full Code Here

Examples of org.wso2.carbon.security.keystore.KeyStoreAdmin

  }

  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;
View Full Code Here

Examples of org.wso2.carbon.security.keystore.KeyStoreAdmin

        KeyStoreAdmin admin = new KeyStoreAdmin(getGovernanceSystemRegistry());
        return admin.getKeyStores();
    }

    private String[] getStoreEntries(String keyStoreName) throws SecurityConfigException {
        KeyStoreAdmin admin = new KeyStoreAdmin(getGovernanceSystemRegistry());
        return admin.getStoreEntries(keyStoreName);
    }
View Full Code Here

Examples of org.wso2.carbon.security.keystore.KeyStoreAdmin

import org.wso2.carbon.security.keystore.KeyStoreAdmin;

public class KeyStoreAdminServiceImpl extends AbstractAdmin implements KeyStoreAdminInterface {

    public KeyStoreData[] getKeyStores() throws SecurityConfigException {
        KeyStoreAdmin admin = new KeyStoreAdmin(getGovernanceSystemRegistry());
        return admin.getKeyStores();

    }
View Full Code Here

Examples of org.wso2.carbon.security.keystore.KeyStoreAdmin

    }

    public void addKeyStore(String fileData, String filename, String password, String provider,
            String type, String pvtkeyPass) throws SecurityConfigException {
        KeyStoreAdmin admin = new KeyStoreAdmin(getGovernanceSystemRegistry());
        admin.addKeyStore(fileData, filename, password, provider, type, pvtkeyPass);
    }
View Full Code Here

Examples of org.wso2.carbon.security.keystore.KeyStoreAdmin

        KeyStoreAdmin admin = new KeyStoreAdmin(getGovernanceSystemRegistry());
        admin.addKeyStore(fileData, filename, password, provider, type, pvtkeyPass);
    }

    public void deleteStore(String keyStoreName) throws SecurityConfigException {
        KeyStoreAdmin admin = new KeyStoreAdmin(getGovernanceSystemRegistry());
        admin.deleteStore(keyStoreName);

    }
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.