Examples of Encryption


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

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 = 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

Examples of org.apache.abdera.security.Encryption

      BufferedRequestWrapper wrapper =
        new BufferedRequestWrapper((HttpServletRequest) request);
      try {
        Document<Element> doc = getDocument(wrapper);
        if (doc != null) {
          Encryption enc = security.getEncryption();
          if (enc.isEncrypted(doc)) {
            Object arg = initArg(request);
            EncryptionOptions options = initEncryptionOptions(request,response,enc,arg);
            doDecryption(doc, options, enc, wrapper);
          }
        }
View Full Code Here

Examples of org.apache.geronimo.crypto.Encryption

        BeanPropertyType[] beanPropertyArray = javabeanType.getBeanPropertyArray();
        assertEquals(1, beanPropertyArray.length);
    }
   
    public void testEncryption() throws Exception {
        Encryption encryption = (Encryption) mock(Encryption.class);
        encryption.encrypt("encryptOnPersist");
        String encryptedValue = "encryptedOnPersist";
        modify().returnValue(encryptedValue);

        startVerification();
       
View Full Code Here

Examples of org.apache.geronimo.crypto.Encryption

        BeanPropertyType[] beanPropertyArray = javabeanType.getBeanPropertyArray();
        assertEquals(1, beanPropertyArray.length);
    }
   
    public void testEncryption() throws Exception {
        Encryption encryption = (Encryption) mock(Encryption.class);
        encryption.encrypt("encryptOnPersist");
        String encryptedValue = "encryptedOnPersist";
        modify().returnValue(encryptedValue);

        startVerification();
       
View Full Code Here

Examples of org.apache.james.protocols.api.Encryption

                // Add the text line decoder which limit the max line length,
                // don't strip the delimiter and use CRLF as delimiter
                // Use a SwitchableDelimiterBasedFrameDecoder, see JAMES-1436
                pipeline.addLast(FRAMER, new SwitchableDelimiterBasedFrameDecoder(maxLineLength, false, Delimiters.lineDelimiter()));
              
                Encryption secure = getEncryption();
                if (secure != null && !secure.isStartTLS()) {
                    // We need to set clientMode to false.
                    // See https://issues.apache.org/jira/browse/JAMES-1025
                    SSLEngine engine = secure.getContext().createSSLEngine();
                    engine.setUseClientMode(false);
                    pipeline.addFirst(SSL_HANDLER, new SslHandler(engine));

                }
                pipeline.addLast(CONNECTION_COUNT_HANDLER, getConnectionCountHandler());
View Full Code Here

Examples of org.apache.james.protocols.api.Encryption

    }

    @Override
    protected ChannelUpstreamHandler createCoreHandler() {
        ImapChannelUpstreamHandler coreHandler;
        Encryption secure = getEncryption();
        if (secure!= null && secure.isStartTLS()) {
           coreHandler = new ImapChannelUpstreamHandler(hello, processor, encoder, getLogger(), compress, plainAuthDisallowed, secure.getContext(), getEnabledCipherSuites());
        } else {
           coreHandler = new ImapChannelUpstreamHandler(hello, processor, encoder, getLogger(), compress, plainAuthDisallowed);
        }
        return coreHandler;
    }
View Full Code Here

Examples of org.apache.karaf.jaas.modules.Encryption

            users.save();
        }
    }

    String getEncryptedPassword(String password) {
        Encryption encryption = encryptionSupport.getEncryption();
        String encryptionPrefix = encryptionSupport.getEncryptionPrefix();
        String encryptionSuffix = encryptionSupport.getEncryptionSuffix();

        if (encryption == null) {
            return password;
        } else {
            boolean prefix = encryptionPrefix == null || password.startsWith(encryptionPrefix);
            boolean suffix = encryptionSuffix == null || password.endsWith(encryptionSuffix);
            if (prefix && suffix) {
                return password;
            } else {
                String p = encryption.encryptPassword(password);
                if (encryptionPrefix != null) {
                    p = encryptionPrefix + p;
                }
                if (encryptionSuffix != null) {
                    p = p + encryptionSuffix;
View Full Code Here

Examples of org.apache.karaf.jaas.modules.Encryption

            users.save();
        }
    }

    String getEncryptedPassword(String password) {
        Encryption encryption = encryptionSupport.getEncryption();
        String encryptionPrefix = encryptionSupport.getEncryptionPrefix();
        String encryptionSuffix = encryptionSupport.getEncryptionSuffix();

        if (encryption == null) {
            return password;
        } else {
            boolean prefix = encryptionPrefix == null || password.startsWith(encryptionPrefix);
            boolean suffix = encryptionSuffix == null || password.endsWith(encryptionSuffix);
            if (prefix && suffix) {
                return password;
            } else {
                String p = encryption.encryptPassword(password);
                if (encryptionPrefix != null) {
                    p = encryptionPrefix + p;
                }
                if (encryptionSuffix != null) {
                    p = p + encryptionSuffix;
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.