Skip to content

Commit

Permalink
remove dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
Michail Gagauz committed May 21, 2015
1 parent c5a531e commit 25d072e
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 54 deletions.
43 changes: 21 additions & 22 deletions .classpath
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/java" including="**/*.java"/>
<classpathentry kind="output" path="target/classes"/>
<classpathentry kind="var" path="M2_REPO/javax/inject/javax.inject/1/javax.inject-1.jar" sourcepath="M2_REPO/javax/inject/javax.inject/1/javax.inject-1-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar" sourcepath="M2_REPO/javax/servlet/servlet-api/2.5/servlet-api-2.5-sources.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="var" path="M2_REPO/org/apache/tapestry/tapestry-core/5.3.8/tapestry-core-5.3.8.jar" sourcepath="M2_REPO/org/apache/tapestry/tapestry-core/5.3.8/tapestry-core-5.3.8-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/commons-codec/commons-codec/1.5/commons-codec-1.5.jar" sourcepath="M2_REPO/commons-codec/commons-codec/1.5/commons-codec-1.5-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/antlr/antlr-runtime/3.3/antlr-runtime-3.3.jar" sourcepath="M2_REPO/org/antlr/antlr-runtime/3.3/antlr-runtime-3.3-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/antlr/stringtemplate/3.2.1/stringtemplate-3.2.1.jar" sourcepath="M2_REPO/org/antlr/stringtemplate/3.2.1/stringtemplate-3.2.1-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/antlr/antlr/2.7.7/antlr-2.7.7.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/tapestry/tapestry-ioc/5.3.8/tapestry-ioc-5.3.8.jar" sourcepath="M2_REPO/org/apache/tapestry/tapestry-ioc/5.3.8/tapestry-ioc-5.3.8-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/tapestry/plastic/5.3.8/plastic-5.3.8.jar" sourcepath="M2_REPO/org/apache/tapestry/plastic/5.3.8/plastic-5.3.8-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/tapestry/tapestry5-annotations/5.3.8/tapestry5-annotations-5.3.8.jar" sourcepath="M2_REPO/org/apache/tapestry/tapestry5-annotations/5.3.8/tapestry5-annotations-5.3.8-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-api/1.6.1/slf4j-api-1.6.1.jar" sourcepath="M2_REPO/org/slf4j/slf4j-api/1.6.1/slf4j-api-1.6.1-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/javassist/javassist/3.12.1.GA/javassist-3.12.1.GA.jar" sourcepath="M2_REPO/javassist/javassist/3.12.1.GA/javassist-3.12.1.GA-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/tapestry/tapestry-func/5.3.8/tapestry-func-5.3.8.jar" sourcepath="M2_REPO/org/apache/tapestry/tapestry-func/5.3.8/tapestry-func-5.3.8-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14.jar" sourcepath="M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-log4j12/1.6.1/slf4j-log4j12-1.6.1.jar" sourcepath="M2_REPO/org/slf4j/slf4j-log4j12/1.6.1/slf4j-log4j12-1.6.1-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/tapestry/tapestry-json/5.3.8/tapestry-json-5.3.8.jar" sourcepath="M2_REPO/org/apache/tapestry/tapestry-json/5.3.8/tapestry-json-5.3.8-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/commons/commons-lang3/3.3.2/commons-lang3-3.3.2.jar" sourcepath="M2_REPO/org/apache/commons/commons-lang3/3.3.2/commons-lang3-3.3.2-sources.jar"/>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/java" including="**/*.java"/>
<classpathentry kind="output" path="target/classes"/>
<classpathentry kind="var" path="M2_REPO/javax/inject/javax.inject/1/javax.inject-1.jar" sourcepath="M2_REPO/javax/inject/javax.inject/1/javax.inject-1-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar" sourcepath="M2_REPO/javax/servlet/servlet-api/2.5/servlet-api-2.5-sources.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="var" path="M2_REPO/org/apache/tapestry/tapestry-core/5.3.8/tapestry-core-5.3.8.jar" sourcepath="M2_REPO/org/apache/tapestry/tapestry-core/5.3.8/tapestry-core-5.3.8-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/commons-codec/commons-codec/1.5/commons-codec-1.5.jar" sourcepath="M2_REPO/commons-codec/commons-codec/1.5/commons-codec-1.5-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/antlr/antlr-runtime/3.3/antlr-runtime-3.3.jar" sourcepath="M2_REPO/org/antlr/antlr-runtime/3.3/antlr-runtime-3.3-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/antlr/stringtemplate/3.2.1/stringtemplate-3.2.1.jar" sourcepath="M2_REPO/org/antlr/stringtemplate/3.2.1/stringtemplate-3.2.1-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/antlr/antlr/2.7.7/antlr-2.7.7.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/tapestry/tapestry-ioc/5.3.8/tapestry-ioc-5.3.8.jar" sourcepath="M2_REPO/org/apache/tapestry/tapestry-ioc/5.3.8/tapestry-ioc-5.3.8-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/tapestry/plastic/5.3.8/plastic-5.3.8.jar" sourcepath="M2_REPO/org/apache/tapestry/plastic/5.3.8/plastic-5.3.8-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/tapestry/tapestry5-annotations/5.3.8/tapestry5-annotations-5.3.8.jar" sourcepath="M2_REPO/org/apache/tapestry/tapestry5-annotations/5.3.8/tapestry5-annotations-5.3.8-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-api/1.6.1/slf4j-api-1.6.1.jar" sourcepath="M2_REPO/org/slf4j/slf4j-api/1.6.1/slf4j-api-1.6.1-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/javassist/javassist/3.12.1.GA/javassist-3.12.1.GA.jar" sourcepath="M2_REPO/javassist/javassist/3.12.1.GA/javassist-3.12.1.GA-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/tapestry/tapestry-func/5.3.8/tapestry-func-5.3.8.jar" sourcepath="M2_REPO/org/apache/tapestry/tapestry-func/5.3.8/tapestry-func-5.3.8-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14.jar" sourcepath="M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-log4j12/1.6.1/slf4j-log4j12-1.6.1.jar" sourcepath="M2_REPO/org/slf4j/slf4j-log4j12/1.6.1/slf4j-log4j12-1.6.1-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/tapestry/tapestry-json/5.3.8/tapestry-json-5.3.8.jar" sourcepath="M2_REPO/org/apache/tapestry/tapestry-json/5.3.8/tapestry-json-5.3.8-sources.jar"/>
</classpath>
26 changes: 13 additions & 13 deletions .project
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>tapestry-security</name>
<comment>NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
<projects/>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>tapestry-security</name>
<comment>NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
<projects/>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
9 changes: 2 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
<version>${tapestry-release-version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.3.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
Expand All @@ -36,7 +31,7 @@
<repository>
<id>sf</id>
<name>SourceForge</name>
<url>scp://xl0e,[email protected]:/home/project-web/tapestrysecurity/htdocs/maven_repo</url>
<url>scpexe://xl0e,[email protected]:/home/project-web/tapestrysecurity/htdocs/maven_repo</url>
</repository>
</distributionManagement>

Expand Down Expand Up @@ -94,7 +89,7 @@
<dependencies>
<dependency><!-- add support for ssh/scp -->
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<artifactId>wagon-ssh-external</artifactId>
<version>2.8</version>
</dependency>
</dependencies>
Expand Down
29 changes: 17 additions & 12 deletions src/main/java/org/gagauz/tapestry/security/SecurityEncryptor.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.gagauz.tapestry.security;

import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.StringUtils;

import javax.crypto.Cipher;
import javax.crypto.SecretKey;
Expand All @@ -10,26 +9,27 @@
import javax.crypto.spec.SecretKeySpec;

import java.security.spec.KeySpec;
import java.util.ArrayList;
import java.util.Collection;

// TODO: Auto-generated Javadoc
/**
* The Class SecurityEncryptor.
*/
public class SecurityEncryptor {

/** The Constant JOIN_STR. */
private static final char JOIN_STR = '\0';
private static final String JOIN_STR = "\0";

/** The Constant ALGORITHM. */
private static final String ALGORITHM = "AES";

/** The encrypt. */
private final Cipher encrypt;

/** The decrypt. */
private final Cipher decrypt;

/** The Constant CH. */
private static final String CH = "latin1";

Expand Down Expand Up @@ -93,8 +93,7 @@ public String decrypt(String encryptedValue) {
* @return the string
*/
public String encryptArray(Collection<String> strings) {
String joined = StringUtils.join(strings, JOIN_STR);
return encrypt(joined);
return encryptArray(new ArrayList<String>(strings).toArray(new String[strings.size()]));
}

/**
Expand All @@ -104,8 +103,14 @@ public String encryptArray(Collection<String> strings) {
* @return the string
*/
public String encryptArray(String... strings) {
String joined = StringUtils.join(strings, JOIN_STR);
return encrypt(joined);
if (strings.length == 0) {
return encrypt("");
}
StringBuilder sb = new StringBuilder(strings[0]);
for (int i = 1; i < strings.length; i++) {
sb.append(JOIN_STR).append(strings[i]);
}
return encrypt(sb.toString());
}

/**
Expand All @@ -116,7 +121,7 @@ public String encryptArray(String... strings) {
*/
public String[] decryptArray(String string) {
string = decrypt(string);
return StringUtils.split(string, JOIN_STR);
return string.split(JOIN_STR);
}

}

0 comments on commit 25d072e

Please sign in to comment.