Package org.apache.juddi.v3.client.cryptor

Examples of org.apache.juddi.v3.client.cryptor.AES128Cryptor.encrypt()


  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) {
View Full Code Here


                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);
View Full Code Here

  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");
                }
View Full Code Here

   *
   */
  private String encrypt(String str) throws FatalErrorException {
    try {
      Cryptor cryptor = (Cryptor) CryptorFactory.getCryptor();
      return cryptor.encrypt(str);
    } catch (InvalidKeyException e) {
      logger.error("Invalid Key Exception in crypting the password", e);
      throw new FatalErrorException(new ErrorMessage(
          "errors.auth.cryptor.InvalidKey", e.getMessage()));
    } catch (NoSuchPaddingException e) {
View Full Code Here

                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);
View Full Code Here

  {
            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());
View Full Code Here

            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();
View Full Code Here

    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

  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) {
View Full Code Here

  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) {
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.