Package org.apache.wicket.util.crypt

Examples of org.apache.wicket.util.crypt.SunJceCrypt


   *
   *
   */
  public void testCrypt()
  {
    final ICrypt crypt = new SunJceCrypt();

    try
    {
      if (crypt.encryptUrlSafe("test") != null)
      {
        final String text = "abcdefghijkABC: A test which creates a '/' and/or a '+'";
        final String expectedUrlSafeEncrypted = "g*N-AGk2b3qe70kJ0we4Rsa8getbnPLm6NyE0BCd*go0P*0kuIe6UvAYP7dlzx*9mfmPaMQ5lCk";

        assertEquals(expectedUrlSafeEncrypted, crypt.encryptUrlSafe(text));
        assertEquals(text, crypt.decryptUrlSafe(expectedUrlSafeEncrypted));
      }
    }
    catch (Exception ex)
    {
      // fails on JVMs without security provider (e.g. seems to be on
View Full Code Here


   *
   *
   */
  public void testCrypt()
  {
    final ICrypt crypt = new SunJceCrypt();

    try
    {
      if (crypt.encryptUrlSafe("test") != null)
      {
        final String text = "abcdefghijkABC: A test which creates a '/' and/or a '+'";
        final String expectedUrlSafeEncrypted = "g-N_AGk2b3qe70kJ0we4Rsa8getbnPLm6NyE0BCd-go0P-0kuIe6UvAYP7dlzx-9mfmPaMQ5lCk";

        final String encrypted = crypt.encryptUrlSafe(text);
        assertEquals(expectedUrlSafeEncrypted, encrypted);
        assertEquals(text, crypt.decryptUrlSafe(expectedUrlSafeEncrypted));
      }
    }
    catch (Exception ex)
    {
      // fails on JVMs without security provider (e.g. seems to be on
View Full Code Here

   *
   *
   */
  public void testCrypt()
  {
    final ICrypt crypt = new SunJceCrypt();

    try
    {
      if (crypt.encryptUrlSafe("test") != null)
      {
        final String text = "abcdefghijkABC: A test which creates a '/' and/or a '+'";
        final String expectedUrlSafeEncrypted = "g-N_AGk2b3qe70kJ0we4Rsa8getbnPLm6NyE0BCd-go0P-0kuIe6UvAYP7dlzx-9mfmPaMQ5lCk";

        final String encrypted = crypt.encryptUrlSafe(text);
        assertEquals(expectedUrlSafeEncrypted, encrypted);
        assertEquals(text, crypt.decryptUrlSafe(expectedUrlSafeEncrypted));
        assertNull(crypt.decryptUrlSafe("style.css"));
      }
    }
    catch (Exception ex)
    {
      // fails on JVMs without security provider (e.g. seems to be on
View Full Code Here

      key = session.getId() + "." + UUID.randomUUID().toString();
      session.setMetaData(KEY, key);
    }

    // build the crypt based on session key
    ICrypt crypt = new SunJceCrypt();
    crypt.setKey(key);
    return crypt;
  }
View Full Code Here

   *
   */
  @Test
  public void crypt()
  {
    final ICrypt crypt = new SunJceCrypt();

    try
    {
      if (crypt.encryptUrlSafe("test") != null)
      {
        final String text = "abcdefghijkABC: A test which creates a '/' and/or a '+'";
        final String expectedUrlSafeEncrypted = "g-N_AGk2b3qe70kJ0we4Rsa8getbnPLm6NyE0BCd-go0P-0kuIe6UvAYP7dlzx-9mfmPaMQ5lCk";

        final String encrypted = crypt.encryptUrlSafe(text);
        assertEquals(expectedUrlSafeEncrypted, encrypted);
        assertEquals(text, crypt.decryptUrlSafe(expectedUrlSafeEncrypted));
        assertNull(crypt.decryptUrlSafe("style.css"));
      }
    }
    catch (Exception ex)
    {
      // fails on JVMs without security provider (e.g. seems to be on
View Full Code Here

TOP

Related Classes of org.apache.wicket.util.crypt.SunJceCrypt

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.