Examples of Encryption


Examples of com.cloudloop.generated.CloudloopConfig.Encryption

      localProps.add( prop );
  }
  localProps.add( localRoot );
  storeList.add( localStore );
 
  Encryption encryption = new Encryption( );
  encryption.setCipher( EncryptionUtil.DEFAULT_CIPHER );
  File currDir = new File( "./test-keys/" );
  FileUtil.mkdir( currDir );
  encryption.setKeyDirectory( currDir.getAbsolutePath( ) );
  encryption.setKeyLength( 128 );
  File keyFile = new File( currDir, TimeUtil.getConciseTimestamp( )
    + ".key" );
  EncryptionUtil
    .generateKey( EncryptionUtil.DEFAULT_CIPHER, 128, keyFile );
  encryption.setPreferredKey( keyFile.getName( ) );
  config.setEncryption( encryption );
 
  return config;
    }
View Full Code Here

Examples of com.cloudloop.generated.CloudloopConfig.Encryption

   
    private void setupEncryption( CloudloopConfig config )
      throws  InvalidConfigurationException,
          IOException
    {
      Encryption encryptionConfig = config.getEncryption( );
      if ( encryptionConfig == null )
      {
        // Encryption not configured. Return...
        return;
      }
     
    File keyDirectory = new File( encryptionConfig.getKeyDirectory( ) );
      if ( !keyDirectory.exists( ) || !keyDirectory.isDirectory( ) )
      {
      throw new InvalidConfigurationException(
        "Could not find encryption key directory '"
        + keyDirectory.getAbsolutePath( ) + "'." );
      }
     
      try
      {
      _encryptionProvider = EncryptionProviderBuilder
        .buildProvider( keyDirectory, encryptionConfig.getPreferredKey( ) );
      }
      catch ( NoSuchAlgorithmException e )
      {
        throw new InvalidConfigurationException( e );
      }
View Full Code Here

Examples of com.cloudloop.generated.CloudloopConfig.Encryption

      done = true;
  }
 
  if ( !output.goBack( ) && !output.quit( ) )
  {
      Encryption newEncryption = new Encryption( );
      newEncryption.setCipher( _cipher );
      newEncryption.setKeyLength( _keyLen );
      newEncryption.setKeyDirectory( _keyDir.getAbsolutePath( ) );
      newEncryption.setPreferredKey( _preferredKey.getName( ) );
      config.setEncryption( newEncryption );
  }
 
  return output;
    }
View Full Code Here

Examples of com.google.gerrit.server.mail.SmtpEmailSender.Encryption

    final String hostname =
        sendemail.string("SMTP server hostname", "smtpServer", "localhost");

    sendemail.string("SMTP server port", "smtpServerPort", "(default)", true);

    final Encryption enc =
        sendemail.select("SMTP encryption", "smtpEncryption", Encryption.NONE,
            true);

    String username = null;
    if (site.gerrit_config.exists()) {
View Full Code Here

Examples of com.openkm.openoffice.util.Encryption

    private String directoryToStoreFiles;
    private String configFilename;
    private Encryption encryption;

    public ConfigFile() throws OKMException {
        encryption = new Encryption();
        directoryToStoreFiles = getDirectoryToStoreFiles();
        if (directoryToStoreFiles==null)  {
            directoryToStoreFiles = FileUtil.getWorkingPath() + OPENKM_FOLDER;
            File file = new File(directoryToStoreFiles);
            if (!file.exists()) {
View Full Code Here

Examples of org.apache.abdera.security.Encryption

    entry.setContentAsXhtml("This <b>is</b> <i>markup</i>");
    entry.addAuthor("James");
    entry.addLink("http://www.example.org");

    // Prepare the encryption options
    Encryption enc = absec.getEncryption();
    EncryptionOptions options = enc.getDefaultEncryptionOptions();
    options.setDataEncryptionKey(key);
   
    // Encrypt the document using the generated key
    Document enc_doc = enc.encrypt(entry.getDocument(), options);
   
    assertEquals(
      enc_doc.getRoot().getQName(),
      new QName(
        "http://www.w3.org/2001/04/xmlenc#",
        "EncryptedData"));
   
    // Decrypt the document using the generated key
    Document<Entry> entry_doc = enc.decrypt(enc_doc, options);

    assertTrue(entry_doc.getRoot() instanceof Entry);
   
    assertEquals(
      entry_doc.getRoot().getId().toString(),
View Full Code Here

Examples of org.apache.abdera.security.Encryption

          new BufferingResponseWrapper(
            (HttpServletResponse)response);
        chain.doFilter(request, wrapper);
        Document<Element> doc = getDocument(wrapper);
        if (doc != null) { 
          Encryption enc = security.getEncryption();
          EncryptionOptions options = context.getEncryptionOptions(enc);
          Document<Element> enc_doc = enc.encrypt(doc, options);
          returnPublicKey((HttpServletResponse)response,context);
          enc_doc.writeTo(response.getOutputStream());
        }
      } else {
        chain.doFilter(request, response);
View Full Code Here

Examples of org.apache.abdera.security.Encryption

        Document<Element> doc = getDocument(wrapper);
        if (doc != null) { 
          KeyGenerator keygen = KeyGenerator.getInstance("AES");
          keygen.init(new SecureRandom());
          Key key = keygen.generateKey();
          Encryption enc = security.getEncryption();
          EncryptionOptions options = enc.getDefaultEncryptionOptions();
          options.setDataEncryptionKey(key);
          options.setKeyEncryptionKey(pkey);
          options.setKeyCipherAlgorithm(XMLCipher.RSA_v1dot5);
          options.setIncludeKeyInfo(true);
          Document<Element> enc_doc = enc.encrypt(doc, options);
          enc_doc.writeTo(response.getOutputStream());
        }
      } else {
        chain.doFilter(request, response);
      }
View Full Code Here

Examples of org.apache.abdera.security.Encryption

    entry.setContentAsXhtml("This <b>is</b> <i>markup</i>");
    entry.addAuthor("James");
    entry.addLink("http://www.example.org");

    // Prepare the encryption options
    Encryption enc = absec.getEncryption();
    EncryptionOptions options = enc.getDefaultEncryptionOptions();
    options.setDataEncryptionKey(key);
   
    // Encrypt the document using the generated key
    Document enc_doc = enc.encrypt(entry.getDocument(), options);

    enc_doc.writeTo(System.out);
   
    System.out.println("\n\n");
   
    // Decrypt the document using the generated key
    Document<Entry> entry_doc = enc.decrypt(enc_doc, options);

    entry_doc.writeTo(System.out);
   
  }
View Full Code Here

Examples of org.apache.abdera.security.Encryption

    DHContext context_a = new DHContext();
    DHContext context_b = new DHContext(context_a.getRequestString());
    context_a.setPublicKey(context_b.getResponseString());

    // Prepare the encryption options
    Encryption enc = absec.getEncryption();
   
    // Encrypt the document using A's DHContext
    EncryptionOptions options = context_a.getEncryptionOptions(enc);
    Document enc_doc = enc.encrypt(entry.getDocument(), options);

    enc_doc.writeTo(System.out);
   
    System.out.println("\n\n");
   
    // Decrypt the document using B's DHContext
    options = context_b.getEncryptionOptions(enc);
    Document<Entry> entry_doc = enc.decrypt(enc_doc, options);

    entry_doc.writeTo(System.out);
   
  }
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.