Package org.apache.abdera.security

Examples of org.apache.abdera.security.EncryptionOptions


  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


    RequestContext request,
    ResponseContext 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

        if (doc != null) {
          AbderaSecurity security = new AbderaSecurity(getAbdera());
          Encryption enc = security.getEncryption();
          if (enc.isEncrypted(doc)) {
            Object arg = initArg(request);
            EncryptionOptions encoptions = initEncryptionOptions(request,enc,arg);
            doc = enc.decrypt(doc, encoptions);
          }
        }
      } catch (Exception e) {}
      return (Document<T>) doc;
View Full Code Here

        ka.doPhase(publicKey, true);
        return ka.generateSecret("DESede");
    }

    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);

        assertEquals(new QName("http://www.w3.org/2001/04/xmlenc#", "EncryptedData"), enc_doc.getRoot().getQName());
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

    protected EncryptionOptions initEncryptionOptions(RequestContext request,
                                                      ResponseContext 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

                if (doc != null) {
                    AbderaSecurity security = new AbderaSecurity(getAbdera());
                    Encryption enc = security.getEncryption();
                    if (enc.isEncrypted(doc)) {
                        Object arg = initArg(request);
                        EncryptionOptions encoptions = initEncryptionOptions(request, enc, arg);
                        doc = enc.decrypt(doc, encoptions);
                    }
                }
            } catch (Exception e) {
            }
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

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.