Package org.syncany.chunk

Examples of org.syncany.chunk.Transformer


      + "    </databaseVersion>\n"
      + "  </databaseVersions>\n"
      + "</database>";
   
   
    Transformer cipherTransformer = new CipherTransformer(cipherSuites, masterKey);
   
    // Test encrypt
    byte[] encryptedData = doEncrypt(StringUtil.toBytesUTF8(xmlStr), cipherTransformer);

    // Test decrypt with SAX parser 
    InputStream is = cipherTransformer.createInputStream(new ByteArrayInputStream(encryptedData));
   
    SAXParserFactory factory = SAXParserFactory.newInstance();
    SAXParser saxParser = factory.newSAXParser();
   
    saxParser.parse(is, new DefaultHandler())
View Full Code Here


    // See http://bouncy-castle.1462172.n4.nabble.com/Using-AES-GCM-NoPadding-with-javax-crypto-CipherInputStream-td4655271.html
    // and http://bouncy-castle.1462172.n4.nabble.com/using-GCMBlockCipher-with-CipherInputStream-td4655147.html
 
 
  private void doTestEncryption(List<CipherSpec> cipherSpecs) throws InvalidKeySpecException, NoSuchAlgorithmException, IOException, CipherException, InvalidKeyException {
    Transformer encryptCipherTransformer = new CipherTransformer(cipherSpecs, masterKey);
    Transformer decryptCipherTransformer = new CipherTransformer(cipherSpecs, masterKey);
   
    // Prepare data
    byte[] srcData = new byte[10*1024];
   
    for (int i=0;i<srcData.length; i++) {
View Full Code Here

    if (repoTO.getTransformers() == null || repoTO.getTransformers().size() == 0) {
      transformer = new NoTransformer();
    }
    else {
      ArrayList<TransformerTO> transformerTOs = new ArrayList<TransformerTO>(repoTO.getTransformers());
      Transformer lastTransformer = null;

      for (int i = transformerTOs.size() - 1; i >= 0; i--) {
        TransformerTO transformerTO = transformerTOs.get(i);
        Transformer transformer = Transformer.getInstance(transformerTO.getType());

        if (transformer == null) {
          throw new ConfigException("Cannot find transformer '" + transformerTO.getType() + "'");
        }

        if (transformer instanceof CipherTransformer) { // Dirty workaround
          transformerTO.getSettings().put(CipherTransformer.PROPERTY_MASTER_KEY, StringUtil.toHex(getMasterKey().getEncoded()));
          transformerTO.getSettings().put(CipherTransformer.PROPERTY_MASTER_KEY_SALT, StringUtil.toHex(getMasterKey().getSalt()));
        }

        transformer.init(transformerTO.getSettings());

        if (lastTransformer != null) {
          transformer.setNextTransformer(lastTransformer);
        }

        lastTransformer = transformer;
      }
View Full Code Here

        File transactionFile = createTempFile("transaction");

        // Download transaction file
        download(transaction, transactionFile);

        Transformer transformer = config == null ? null : config.getTransformer();
        TransactionTO transactionTO = TransactionTO.load(transformer, transactionFile);

        // Extract final locations
        transactions.put(transactionTO, transaction);
        transactionFile.delete();
View Full Code Here

TOP

Related Classes of org.syncany.chunk.Transformer

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.