Examples of Cryptor


Examples of org.apache.juddi.v3.client.cryptor.Cryptor

  {
                System.out.println("testDecryptFromConfigXML_InMemory");
    try {
                    Configuration config =AppConfig.getConfiguration();
                   
      Cryptor auth = new AES128Cryptor();
                        String encrypt = auth.encrypt("test");
                        Assert.assertNotNull(encrypt);
                        Assert.assertNotSame(encrypt, "test");
                       
                        //add to the config
                        config.addProperty("testDecryptFromConfigXML", encrypt);
                        config.addProperty("testDecryptFromConfigXML"+ Property.ENCRYPTED_ATTRIBUTE, "true");
                       
                        //retrieve it
                        String pwd = config.getString("testDecryptFromConfigXML");
                        Assert.assertNotNull(pwd);
                        //test for encryption
                        if (config.getBoolean("testDecryptFromConfigXML" + Property.ENCRYPTED_ATTRIBUTE, false))
                        {
                            String test=auth.decrypt(pwd);
                            Assert.assertEquals(test, "test");
                        }
                        else
                        {
                            Assert.fail("config reports that the setting is not encrypted");
View Full Code Here

Examples of org.apache.juddi.v3.client.cryptor.Cryptor

                    System.out.println("Current working dir is " + f.getAbsolutePath());
                    System.setProperty(AppConfig.JUDDI_CONFIGURATION_FILE_SYSTEM_PROPERTY,f.getAbsolutePath() + "/src/test/resources/juddiv3-enc-default.xml");
                    AppConfig.reloadConfig();
                    Configuration config =AppConfig.getConfiguration();
                   
      Cryptor auth = new DefaultCryptor();
                       
                        //retrieve it
                        String pwd = config.getString("juddi.mail.smtp.password");
                        Assert.assertNotNull(pwd);
                        //test for encryption
                        if (config.getBoolean("juddi.mail.smtp.password" + Property.ENCRYPTED_ATTRIBUTE, false))
                        {
                            String test=auth.decrypt(pwd);
                            Assert.assertEquals(test, "password");
                        }
                        else
                        {
                            Assert.fail("config reports that the setting is not encrypted");
View Full Code Here

Examples of org.apache.juddi.v3.client.cryptor.Cryptor

                    System.out.println("Current working dir is " + f.getAbsolutePath());
                    System.setProperty(AppConfig.JUDDI_CONFIGURATION_FILE_SYSTEM_PROPERTY, f.getAbsolutePath() +"/src/test/resources/juddiv3-enc-3des.xml");
                    AppConfig.reloadConfig();
                    Configuration config =AppConfig.getConfiguration();
                   
      Cryptor auth = new TripleDESCrytor();
                       
                        //retrieve it
                        String pwd = config.getString("juddi.mail.smtp.password");
                        Assert.assertNotNull(pwd);
                        //test for encryption
                        if (config.getBoolean("juddi.mail.smtp.password" + Property.ENCRYPTED_ATTRIBUTE, false))
                        {
                            String test=auth.decrypt(pwd);
                            Assert.assertEquals(test, "password");
                        }
                        else
                        {
                            Assert.fail("config reports that the setting is not encrypted");
View Full Code Here

Examples of org.apache.juddi.v3.client.cryptor.Cryptor

                   
                    System.setProperty(AppConfig.JUDDI_CONFIGURATION_FILE_SYSTEM_PROPERTY, f.getAbsolutePath() +"/src/test/resources/juddiv3-enc-aes128.xml");
                    AppConfig.reloadConfig();
                    Configuration config =AppConfig.getConfiguration();
                   
      Cryptor auth = new AES128Cryptor();
                       
                        //retrieve it
                        String pwd = config.getString("juddi.mail.smtp.password");
                        Assert.assertNotNull(pwd);
                        //test for encryption
                        if (config.getBoolean("juddi.mail.smtp.password" + Property.ENCRYPTED_ATTRIBUTE, false))
                        {
                            String test=auth.decrypt(pwd);
                            Assert.assertEquals(test, "password");
                        }
                        else
                        {
                            Assert.fail("config reports that the setting is not encrypted");
View Full Code Here

Examples of org.apache.juddi.v3.client.cryptor.Cryptor

                    System.out.println("Current working dir is " + f.getAbsolutePath());
                    System.setProperty(AppConfig.JUDDI_CONFIGURATION_FILE_SYSTEM_PROPERTY, f.getAbsolutePath() + "/src/test/resources/juddiv3-enc-aes256.xml");
                    AppConfig.reloadConfig();
                    Configuration config =AppConfig.getConfiguration();
                   
      Cryptor auth = new AES256Cryptor();
                       
                        //retrieve it
                        String pwd = config.getString("juddi.mail.smtp.password");
                        Assert.assertNotNull(pwd);
                        //test for encryption
                        if (config.getBoolean("juddi.mail.smtp.password" + Property.ENCRYPTED_ATTRIBUTE, false))
                        {
                            String test=auth.decrypt(pwd);
                            Assert.assertEquals(test, "password");
                        }
                        else
                        {
                            Assert.fail("config reports that the setting is not encrypted");
View Full Code Here

Examples of org.apache.juddi.v3.client.cryptor.Cryptor

  @Test
  public void testCreateJuddiUsersEncrypted() throws Exception
  {
            System.out.println("testCreateJuddiUsersEncrypted");
    try {
      Cryptor cryptor = CryptorFactory.getCryptor();
      JuddiUsers juddiUsers = new JuddiUsers();
      juddiUsers.getUser().add(new User("anou_mana",cryptor.encrypt("password")));
      juddiUsers.getUser().add(new User("bozo",cryptor.encrypt("clown")));
      juddiUsers.getUser().add(new User("sviens",cryptor.encrypt("password")));
     
      StringWriter writer = new StringWriter();
      JAXBContext context = JAXBContext.newInstance(juddiUsers.getClass());
      Marshaller marshaller = context.createMarshaller();
      marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
View Full Code Here

Examples of org.apache.juddi.v3.client.cryptor.Cryptor

        @Test
  public void testAES128Cryptor()
  {
            System.out.println("testAES128Cryptor");
    try {
      Cryptor auth = new AES128Cryptor();
                        String encrypt = auth.encrypt("test");
                        Assert.assertNotNull(encrypt);
                        Assert.assertNotSame(encrypt, "test");
                        String test=auth.decrypt(encrypt);
                        Assert.assertEquals(test, "test");
    } catch (Exception e) {
      logger.error(e.getMessage(),e);
      Assert.fail("unexpected");
    }
View Full Code Here

Examples of org.apache.juddi.v3.client.cryptor.Cryptor

        @Test
  public void testTripleDESCryptor()
  {
            System.out.println("testTripleDESCryptor");
    try {
      Cryptor auth = new TripleDESCrytor();
                        String encrypt = auth.encrypt("test");
                        Assert.assertNotNull(encrypt);
                        Assert.assertNotSame(encrypt, "test");
                        String test=auth.decrypt(encrypt);
                        Assert.assertEquals(test, "test");
    } catch (Exception e) {
      logger.error(e.getMessage(),e);
      Assert.fail("unexpected");
    }
View Full Code Here

Examples of org.apache.juddi.v3.client.cryptor.Cryptor

        @Test
  public void testDefaultCryptor()
  {
            System.out.println("testDefaultCryptor");
    try {
      Cryptor auth = new DefaultCryptor();
                        String encrypt = auth.encrypt("test");
                        Assert.assertNotNull(encrypt);
                        Assert.assertNotSame(encrypt, "test");
                        String test=auth.decrypt(encrypt);
                        Assert.assertEquals(test, "test");
    } catch (Exception e) {
      logger.error(e.getMessage(),e);
      Assert.fail("unexpected");
    }
View Full Code Here

Examples of org.apache.juddi.v3.client.cryptor.Cryptor

        @Test
  public void testAES256Cryptor()
  {
                System.out.println("testAES256Cryptor");
    try {
      Cryptor auth = new AES256Cryptor();
                        String encrypt = auth.encrypt("test");
                        Assert.assertNotNull(encrypt);
                        Assert.assertNotSame(encrypt, "test");
                        String test=auth.decrypt(encrypt);
                        Assert.assertEquals(test, "test");
                }
                catch (InvalidKeyException e)
                {
                    logger.error("Hey, you're probably using the Oracle JRE without the Unlimited Strength Java Crypto Extensions installed. AES256 won't work until you download and install it", e);
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.