Package de.innovationgate.utils

Examples of de.innovationgate.utils.DESEncrypter$PersistentKeyException


    protected Reader createReader(FileObject file) throws UnsupportedEncodingException, FileNotFoundException, FileSystemException {
       
        InputStream in = file.getContent().getInputStream();
       
        // If obfuscation enabled, use cipher to read code/metadata of script and tml deployments
        DESEncrypter cipher = getManager().getCipher();
        if (cipher != null && (getType() == WGDocument.TYPE_TML || getType() == WGDocument.TYPE_CSSJS)) {
            in = new CipherInputStream(in, cipher.getDcipher());
        }
              
        String encoding = getManager().getFileEncoding();
        // No more used because this creates a lot of problems with empty files
        // CharsetDecoder deco = Charset.forName(encoding).newDecoder();
View Full Code Here


            String configFilePath = retrieveConfigPath();
            // init DES-Encrypter
            File desKeyFile = new File(configFilePath, "des.key");

            desEncrypter = new DESEncrypter();
            try {
                try {
                    desEncrypter.init(desKeyFile);
                    log.info("DESEncrypter initialized using keyfile '" + desKeyFile.getPath() + "'.");
                }
View Full Code Here

    private void determineEncryption() throws WGDesignSyncException {
        try {
            FileObject file = getBaseFolder().resolveFile(DesignDirectory.OBFUSCATE_FLAGFILE);
            if (file.exists()) {
                _cipher = new DESEncrypter();
                _cipher.initObfuscation();
            }
        }
        catch (Exception e) {
            throw new WGDesignSyncException("Exception inizializing deobfuscation", e);
View Full Code Here

     private File _scriptDir;
     private boolean _obfuscate;

     public PluginISProvider(File designDirectory, boolean obfuscate) throws PersistentKeyException, GeneralSecurityException, IOException {
       if (obfuscate) {
         _cipher = new DESEncrypter();
       _cipher.initObfuscation();
       }
         _tmlDir = new File(designDirectory, DesignDirectory.FOLDERNAME_TML);
         _scriptDir = new File(designDirectory, DesignDirectory.FOLDERNAME_SCRIPT);
         _obfuscate = obfuscate;
View Full Code Here

     * @throws GeneralSecurityException
     * @throws IOException
     */
    public RSAEncryptedData encrypt(byte[] data) throws GeneralSecurityException, IOException {
        // create a tempoary desEncrypter with random desKEY
        DESEncrypter desEncrypter = new DESEncrypter();
        desEncrypter.init();       
      
        X509EncodedKeySpec pubKeySpec = new X509EncodedKeySpec(RSAKeyPairUtils.getPublicKey(_keyPair));       
        KeyFactory keyFactory = KeyFactory.getInstance("RSA");
        Cipher ecipher = Cipher.getInstance("RSA");       
        ecipher.init(Cipher.ENCRYPT_MODE, keyFactory.generatePublic(pubKeySpec));
       
        // encrypt desKey with rsaPubKey
        byte[] desKey = ecipher.doFinal(desEncrypter.getKey().getEncoded());       
       
        // encrypt data with des key
        String desData = desEncrypter.encrypt(data);
       
        return new RSAEncryptedData(Base64.encode(desKey), desData);
    }
View Full Code Here

        DESKeySpec desKeySpec = new DESKeySpec(desKeyData);
        SecretKeyFactory desKeyFactory = SecretKeyFactory.getInstance("DES");
        SecretKey desKey = desKeyFactory.generateSecret(desKeySpec);

        // create desEncrypter with decrypted desKey
        DESEncrypter desEncrypter = new DESEncrypter();
        desEncrypter.init(desKey);
       
        // decrypt data
        return desEncrypter.decrypt(input.getData());
    }
View Full Code Here

TOP

Related Classes of de.innovationgate.utils.DESEncrypter$PersistentKeyException

Copyright © 2018 www.massapicom. 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.