Package org.apache.abdera.security

Examples of org.apache.abdera.security.EncryptionOptions


    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(
View Full Code Here


            (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 {
View Full Code Here

        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

 
  public EncryptionOptions getEncryptionOptions(
    Encryption enc)
      throws InvalidKeyException,
             NoSuchAlgorithmException {
    EncryptionOptions options = enc.getDefaultEncryptionOptions();
    options.setDataEncryptionKey(generateSecret());
    options.setDataCipherAlgorithm(XMLCipher.TRIPLEDES);
    return options;
  }
View Full Code Here

    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);
View Full Code Here

    // 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");
View Full Code Here

    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);
View Full Code Here

 
  public EncryptionOptions getEncryptionOptions(
    Encryption enc)
      throws InvalidKeyException,
             NoSuchAlgorithmException {
    EncryptionOptions options = enc.getDefaultEncryptionOptions();
    options.setDataEncryptionKey(generateSecret());
    options.setDataCipherAlgorithm(XMLCipher.TRIPLEDES);
    return options;
  }
View Full Code Here

  protected EncryptionOptions initEncryptionOptions(
      RequestContext request,
      ResponseContext response,
      Encryption enc,
      Object arg) {
    EncryptionOptions options = null;
    try {
      DHContext context = (DHContext) arg;
      options = context.getEncryptionOptions(enc);
      returnPublicKey(response,context);
    } catch (Exception e) {}
View Full Code Here

        ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
        doc = abdera.getParser().parse(in);
      } catch (Exception e) {}
      if (doc != null) { 
        Encryption enc = security.getEncryption();
        EncryptionOptions options = initEncryptionOptions(request,response,enc,arg);
        doc = enc.encrypt(doc, options);
      }
      if (doc != null)
        doc.writeTo(aout);
      else
View Full Code Here

TOP

Related Classes of org.apache.abdera.security.EncryptionOptions

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.