Examples of CryptoUtil


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

            throw new SecurityConfigException(msg.toString());
        }
    }

    private String getDecryptedPassword(String encryptedString) throws SecurityConfigException {
        CryptoUtil cryptoUtil = CryptoUtil.getDefaultCryptoUtil();
        try {
            return new String(cryptoUtil.base64DecodeAndDecrypt(encryptedString));
        } catch (CryptoException e) {
            String msg = "Unable to decode and decrypt password string.";
            log.error(msg, e);
            throw new SecurityConfigException(msg, e);
        }
View Full Code Here

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

                    } 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);
                            password = new String(cryptoUtil
                                    .base64DecodeAndDecrypt(encryptedPassword));
                            break;
                        }
                    }
View Full Code Here

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

      }

      // just to test weather pvt key password is correct.
      keyStore.getKey(pvtKeyAlias, pvtkeyPass.toCharArray());

      CryptoUtil cryptoUtil = CryptoUtil.getDefaultCryptoUtil();

      Resource resource = registry.newResource();
      resource.addProperty(SecurityConstants.PROP_PASSWORD, cryptoUtil
          .encryptAndBase64Encode(password.getBytes()));
      resource.addProperty(SecurityConstants.PROP_PROVIDER, provider);
      resource.addProperty(SecurityConstants.PROP_TYPE, type);

      if (pvtKeyAlias != null) {
        resource.addProperty(SecurityConstants.PROP_PRIVATE_KEY_ALIAS, pvtKeyAlias);
        resource.addProperty(SecurityConstants.PROP_PRIVATE_KEY_PASS, cryptoUtil
            .encryptAndBase64Encode(pvtkeyPass.getBytes()));
      }

      resource.setContent(content);
      registry.put(path, resource);
View Full Code Here

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

        keyStore = manager.getKeyStore(keyStoreName);
        keyStoreType = resource.getProperty(SecurityConstants.PROP_TYPE);

        String encpass = resource.getProperty(SecurityConstants.PROP_PRIVATE_KEY_PASS);

        CryptoUtil util = CryptoUtil.getDefaultCryptoUtil();
        privateKeyPassowrd = new String(util.base64DecodeAndDecrypt(encpass));

      }
      // Fill the information about the certificates
      Enumeration<String> aliases = keyStore.aliases();
      List<org.wso2.carbon.security.keystore.service.CertData> certDataList = new ArrayList<CertData>();
View Full Code Here

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

            bean.setName(resource.getProperty(CSGConstant.NAME));
            bean.setUserName(resource.getProperty(CSGConstant.USER_NAME));
            bean.setPort(resource.getProperty(CSGConstant.PORT));
            bean.setDomainName(resource.getProperty(CSGConstant.DOMAIN_NAME));

            CryptoUtil cryptoUtil = CryptoUtil.getDefaultCryptoUtil();
            String plainPassWord = new String(cryptoUtil.base64DecodeAndDecrypt(
                    resource.getProperty(CSGConstant.PASS_WORD)));
            bean.setPassWord(plainPassWord);

            return bean;
        } catch (CryptoException e) {
View Full Code Here

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

            resource.addProperty(CSGConstant.HOST, csgServer.getHost());
            resource.addProperty(CSGConstant.USER_NAME, csgServer.getUserName());
            resource.addProperty(CSGConstant.PORT, csgServer.getPort());
            resource.addProperty(CSGConstant.DOMAIN_NAME, csgServer.getDomainName());

            CryptoUtil cryptoUtil = CryptoUtil.getDefaultCryptoUtil();
            resource.addProperty(CSGConstant.PASS_WORD, cryptoUtil.encryptAndBase64Encode(
                    csgServer.getPassWord().getBytes()));

            registry.put(CSGConstant.REGISTRY_SERVER_RESOURCE_PATH + "/" + csgServer.getName(),
                    resource);
        } catch (Exception e) {
View Full Code Here

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

                    bean.setName(resource.getProperty(CSGConstant.NAME));
                    bean.setUserName(resource.getProperty(CSGConstant.USER_NAME));
                    bean.setPort(resource.getProperty(CSGConstant.PORT));
                    bean.setDomainName(resource.getProperty(CSGConstant.DOMAIN_NAME));

                    CryptoUtil cryptoUtil = CryptoUtil.getDefaultCryptoUtil();

                    bean.setPassWord(new String(cryptoUtil.base64DecodeAndDecrypt(
                            resource.getProperty("password"))));
                } catch (CryptoException e) {
                    handleException("Cloud not convert into an AXIOM element");
                }
            } else {
View Full Code Here

Examples of ua.pp.bizon.cripto.keystore.CryptoUtil

    public void testFile() throws Exception {
        LOG.info("*****test file started******");
        IPath from = FileFactory.getLocalFile(prefix + "1.pdf");
        FtpConfig readConfig = FtpConfig.readConfig(HOST);
        IPath to = FileFactory.getRemoteFile(readConfig.getUrl(), readConfig.getLogin(), readConfig.getPass(), "backup/1/1.pdf");
        CryptoUtil cryptoUtil = new CryptoUtil(credentials);
        Configuration c = new Configuration();
        c.setDirection(Direction.ENCODE);
        c.setFrom(from);
        c.setTo(to);
        cryptoUtil.process(c);
        LOG.info("*****write to server done******");
        IPath response = FileFactory.getLocalFile(prefix + "2.pdf");
        c.setDirection(Direction.DECODE);
        c.setFrom(to);
        c.setTo(response);
        cryptoUtil.process(c);
        LOG.info("*****load from server done******");
        assertTrue(FileUtils.contentEquals(new File(from.getPath()), new File(response.getPath())));
        LOG.info("*****assert files done******");
        new File(prefix + "2.pdf").delete();
        FTPClient client = new FTPClient();
View Full Code Here

Examples of ua.pp.bizon.cripto.keystore.CryptoUtil

    public void testDirectory() throws Exception {
        LOG.info("*****test directory started******");
        IPath from = FileFactory.getLocalFile(prefix + "directory");
        FtpConfig readConfig = FtpConfig.readConfig(HOST);
        IPath to = FileFactory.getRemoteFile(readConfig.getUrl(), readConfig.getLogin(), readConfig.getPass(), "backup/2/");
        CryptoUtil cryptoUtil = new CryptoUtil(credentials);
        Configuration c = new Configuration();
        c.setDirection(Direction.ENCODE);
        c.setFrom(from);
        c.setTo(to);
        cryptoUtil.process(c);
        LOG.info("*****write to server done******");
        IPath response = FileFactory.getLocalFile(prefix + "responce");
        c.setDirection(Direction.DECODE);
        c.setFrom(to);
        c.setTo(response);
        cryptoUtil.process(c);
        LOG.info("*****load from server done******");
        assertDirectories(new File(from.getPath()), new File(response.getPath()));
        LOG.info("*****assert directories done******");
        FileUtils.deleteDirectory(new File(response.getPath()));
        assertTrue(to.delete());
View Full Code Here

Examples of ua.pp.bizon.cripto.keystore.CryptoUtil

        process();
            }// GEN-LAST:event_decodeButtonActionPerformed

    protected void process() {
        try {
            new CryptoUtil(credentials).process(new Configuration(selectFromPathPanel.getSelected(), selectToPathPanel.getSelected(), direction));
        } catch (CryptoException e) {
            JOptionPane.showMessageDialog(this, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
        }
    }
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.