Examples of DecryptionProvider


Examples of org.apache.synapse.securevault.DecryptionProvider

        CipherInformation cipherInformation = new CipherInformation();
        cipherInformation.setAlgorithm(algorithm);
        cipherInformation.setCipherOperationMode(CipherOperationMode.DECRYPT);
        cipherInformation.setInType(EncodingType.BASE64); //TODO
        DecryptionProvider baseCipher =
                CipherFactory.createCipher(cipherInformation, keyStoreWrapper);

        for (Object alias : cipherProperties.keySet()) {
            //decrypt the encrypted text
            String key = String.valueOf(alias);
            String encryptedText = cipherProperties.getProperty(key);
            if (encryptedText == null || "".equals(encryptedText.trim())) {
                if (log.isDebugEnabled()) {
                    log.debug("There is no secret for the alias : " + alias);
                }
                continue;
            }

            String decryptedText = new String(baseCipher.decrypt(encryptedText.trim().getBytes()));
            secrets.put(key, decryptedText);
        }
        initialize = true;
    }
View Full Code Here

Examples of org.apache.synapse.securevault.DecryptionProvider

    private static String decrypt(String encryptedSecret) {
        CipherInformation cipherInformation = new CipherInformation();
        cipherInformation.setAlgorithm(ALGORITHM);
        cipherInformation.setCipherOperationMode(CipherOperationMode.DECRYPT);
        cipherInformation.setInType(EncodingType.BIGINTEGER16); //TODO
        DecryptionProvider decryptionProvider = CipherFactory.createCipher(cipherInformation, key);
        return new String(decryptionProvider.decrypt(encryptedSecret.getBytes()));
    }
View Full Code Here

Examples of org.apache.synapse.securevault.DecryptionProvider

        CipherInformation cipherInformation = new CipherInformation();
        cipherInformation.setAlgorithm(algorithm);
        cipherInformation.setCipherOperationMode(CipherOperationMode.DECRYPT);
        cipherInformation.setInType(EncodingType.BASE64); //TODO
        DecryptionProvider baseCipher =
                CipherFactory.createCipher(cipherInformation, keyStoreWrapper);

        for (Object alias : cipherProperties.keySet()) {
            //decrypt the encrypted text
            String key = String.valueOf(alias);
            String encryptedText = cipherProperties.getProperty(key);
            encryptedData.put(key, encryptedText);
            if (encryptedText == null || "".equals(encryptedText.trim())) {
                if (log.isDebugEnabled()) {
                    log.debug("There is no secret for the alias : " + alias);
                }
                continue;
            }

            String decryptedText = new String(baseCipher.decrypt(encryptedText.trim().getBytes()));
            secrets.put(key, decryptedText);
        }
        initialize = true;
    }
View Full Code Here

Examples of org.apache.synapse.securevault.DecryptionProvider

    private static String decrypt(String encryptedSecret) {
        CipherInformation cipherInformation = new CipherInformation();
        cipherInformation.setAlgorithm(ALGORITHM);
        cipherInformation.setCipherOperationMode(CipherOperationMode.DECRYPT);
        cipherInformation.setInType(EncodingType.BIGINTEGER16); //TODO
        DecryptionProvider decryptionProvider = CipherFactory.createCipher(cipherInformation, key);
        return new String(decryptionProvider.decrypt(encryptedSecret.getBytes()));
    }
View Full Code Here

Examples of org.wso2.securevault.DecryptionProvider

        CipherInformation cipherInformation = new CipherInformation();
        cipherInformation.setAlgorithm(algorithm);
        cipherInformation.setCipherOperationMode(CipherOperationMode.DECRYPT);
        cipherInformation.setInType(EncodingType.BASE64); //TODO
        DecryptionProvider baseCipher =
                CipherFactory.createCipher(cipherInformation, keyStoreWrapper);

        for (Object alias : cipherProperties.keySet()) {
            //decrypt the encrypted text
            String key = String.valueOf(alias);
            String encryptedText = cipherProperties.getProperty(key);
            encryptedData.put(key, encryptedText);
            if (encryptedText == null || "".equals(encryptedText.trim())) {
                if (log.isDebugEnabled()) {
                    log.debug("There is no secret for the alias : " + alias);
                }
                continue;
            }

            String decryptedText = new String(baseCipher.decrypt(encryptedText.trim().getBytes()));
            secrets.put(key, decryptedText);
        }
        initialize = true;
    }
View Full Code Here

Examples of org.wso2.securevault.DecryptionProvider

            boolean isEncrypt = (cipherInformation.getCipherOperationMode() ==
                    CipherOperationMode.ENCRYPT);

            EncryptionProvider encryptionProvider = null;
            DecryptionProvider decryptionProvider = null;

            if (key != null) {

                if (isEncrypt) {
                    encryptionProvider = CipherFactory.createCipher(cipherInformation, key);
                } else {
                    decryptionProvider = CipherFactory.createCipher(cipherInformation, key);
                }

            } else {

                boolean isTrusted = isArgumentPresent(cmd, TRUSTED);

                KeyStoreWrapper keyStoreWrapper;

                if (isTrusted) {
                    keyStoreWrapper = new TrustKeyStoreWrapper();
                    ((TrustKeyStoreWrapper) keyStoreWrapper).init(getTrustKeyStoreInformation(cmd));
                } else {
                    keyStoreWrapper = new IdentityKeyStoreWrapper();
                    //Password for access private key
                    String keyPass = getArgument(cmd, KEY_PASS, null);
                    assertEmpty(keyPass, KEY_PASS);
                    ((IdentityKeyStoreWrapper) keyStoreWrapper).init(
                            getIdentityKeyStoreInformation(cmd), keyPass);
                }

                if (isEncrypt) {
                    encryptionProvider = CipherFactory.createCipher(cipherInformation,
                            keyStoreWrapper);
                } else {
                    decryptionProvider = CipherFactory.createCipher(cipherInformation,
                            keyStoreWrapper);
                }
            }

            PrintStream out = System.out;
            if (isEncrypt) {
                out.println("Output : " + new String(encryptionProvider.encrypt(source.getBytes())));
            } else {
                out.println("Output : " + new String(decryptionProvider.decrypt(source.getBytes())));
            }

        } catch (ParseException e) {
            handleException("Error passing arguments ", e);
        }
View Full Code Here

Examples of org.wso2.securevault.DecryptionProvider

    private static String decrypt(String encryptedSecret) {
        CipherInformation cipherInformation = new CipherInformation();
        cipherInformation.setAlgorithm(ALGORITHM);
        cipherInformation.setCipherOperationMode(CipherOperationMode.DECRYPT);
        cipherInformation.setInType(EncodingType.BIGINTEGER16); //TODO
        DecryptionProvider decryptionProvider = CipherFactory.createCipher(cipherInformation, key);
        return new String(decryptionProvider.decrypt(encryptedSecret.getBytes()));
    }
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.