Package org.apache.abdera.security

Examples of org.apache.abdera.security.EncryptionOptions


                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


        }
        return context;
    }

    protected EncryptionOptions initEncryptionOptions(RequestContext request, Encryption encryption, Object arg) {
        EncryptionOptions options = null;
        if (arg != null && arg instanceof DHContext) {
            try {
                options = ((DHContext)arg).getEncryptionOptions(encryption);
            } catch (Exception e) {
            }
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);
   
    assertEquals(
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);
   
    assertEquals(
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

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

  protected EncryptionOptions initEncryptionOptions(
    ServletRequest request,
    ServletResponse response,
    Encryption encryption,
    Object arg) {
      EncryptionOptions options = null;
      if (arg != null && arg instanceof DHContext) {
        try {
          options = ((DHContext)arg).getEncryptionOptions(encryption);
        } catch (Exception e) {}
      }
View Full Code Here

    ServletRequest request,
    ServletResponse response,
    Encryption enc,
    Object arg) {
    try {
      EncryptionOptions options = enc.getDefaultEncryptionOptions();
      options.setDataEncryptionKey(KeyHelper.generateKey("AES"));
      options.setKeyEncryptionKey((PublicKey)arg);
      options.setKeyCipherAlgorithm(XMLCipher.RSA_v1dot5);
      options.setIncludeKeyInfo(true);
      return options;
    } catch (Exception e) {
      return null;
    }
  }
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.