3

私はすでにesapiに問題がありましたが、最終的には機能しました...

pom.xml私はこのようにOWASPESAPIを含めました

<!-- ESAPI Version 2.0.1 -->
<dependency>
    <groupId>org.owasp.esapi</groupId>
    <artifactId>esapi</artifactId>
    <version>2.0.1</version>
    <exclusions>
        <exclusion>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
        </exclusion>
    </exclusions>

この関数を実行すると:

String clean = ESAPI.encoder().canonicalize("someString");

ESAPIエンコーダーは完璧に機能します...

しかし、HASH関数を使おうとすると、

ESAPI.encryptor().hash(password, salt);

私はこの結果を得ました

javax.servlet.ServletException: javax.ejb.EJBException: org.owasp.esapi.errors.ConfigurationException: java.lang.ClassNotFoundException: org.owasp.esapi.reference.JavaEncryptor from [Module "deployment.demoapp_demo.war:main" from Service Module Loader] Encryptor class (org.owasp.esapi.reference.JavaEncryptor) must be in class path.
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:606)
    org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62)

ご覧のとおり、ESAPIは私の依存関係ですが、JavaEncryptorが見つかりません。

joergi@nerdbook:~/dev/demoapp/trunk/demoapp_demo$ mvn dependency:tree
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'dependency'.
[INFO] ------------------------------------------------------------------------
[INFO] Building Java EE 6 webapp project
[INFO]    task-segment: [dependency:tree]
[INFO] ------------------------------------------------------------------------
[INFO] [dependency:tree {execution: default-cli}]
[INFO] de.demoapp:demoapp_demo:war:1.0-SNAPSHOT
[INFO] +- javax.enterprise:cdi-api:jar:1.0-SP4:provided
[INFO] |  +- org.jboss.spec.javax.interceptor:jboss-interceptors-api_1.1_spec:jar:1.0.0.Final:provided (version managed from 1.0.0.Beta1)
[INFO] |  \- javax.inject:javax.inject:jar:1:provided
[INFO] +- org.jboss.spec.javax.annotation:jboss-annotations-api_1.1_spec:jar:1.0.0.Final:provided
[INFO] +- org.jboss.spec.javax.ws.rs:jboss-jaxrs-api_1.1_spec:jar:1.0.0.Final:provided
[INFO] +- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.1.Final:provided
[INFO] +- org.jboss.spec.javax.ejb:jboss-ejb-api_3.1_spec:jar:1.0.1.Final:provided
[INFO] +- org.hibernate:hibernate-validator:jar:4.2.0.Final:provided
[INFO] |  \- javax.validation:validation-api:jar:1.0.0.GA:provided
[INFO] +- org.hibernate:hibernate-jpamodelgen:jar:1.1.1.Final:provided
[INFO] +- junit:junit:jar:4.10:test
[INFO] |  \- org.hamcrest:hamcrest-core:jar:1.1:test
[INFO] +- org.jboss.arquillian.junit:arquillian-junit-container:jar:1.0.0.CR4:test
[INFO] |  +- org.jboss.arquillian.junit:arquillian-junit-core:jar:1.0.0.CR4:test
[INFO] |  +- org.jboss.arquillian.test:arquillian-test-api:jar:1.0.0.CR4:test
[INFO] |  |  \- org.jboss.arquillian.core:arquillian-core-api:jar:1.0.0.CR4:test
[INFO] |  +- org.jboss.arquillian.test:arquillian-test-spi:jar:1.0.0.CR4:test
[INFO] |  |  +- org.jboss.arquillian.core:arquillian-core-spi:jar:1.0.0.CR4:test
[INFO] |  |  \- org.jboss.shrinkwrap:shrinkwrap-api:jar:1.0.0-beta-5:test
[INFO] |  +- org.jboss.arquillian.container:arquillian-container-test-api:jar:1.0.0.CR4:test
[INFO] |  +- org.jboss.arquillian.container:arquillian-container-test-spi:jar:1.0.0.CR4:test
[INFO] |  +- org.jboss.arquillian.core:arquillian-core-impl-base:jar:1.0.0.CR4:test
[INFO] |  +- org.jboss.arquillian.test:arquillian-test-impl-base:jar:1.0.0.CR4:test
[INFO] |  +- org.jboss.arquillian.container:arquillian-container-impl-base:jar:1.0.0.CR4:test
[INFO] |  |  +- org.jboss.arquillian.config:arquillian-config-api:jar:1.0.0.CR4:test
[INFO] |  |  \- org.jboss.arquillian.config:arquillian-config-impl-base:jar:1.0.0.CR4:test
[INFO] |  |     \- org.jboss.shrinkwrap.descriptors:shrinkwrap-descriptors-spi:jar:1.1.0-alpha-2:test
[INFO] |  +- org.jboss.arquillian.container:arquillian-container-test-impl-base:jar:1.0.0.CR4:test
[INFO] |  \- org.jboss.shrinkwrap:shrinkwrap-impl-base:jar:1.0.0-beta-5:test
[INFO] |     \- org.jboss.shrinkwrap:shrinkwrap-spi:jar:1.0.0-beta-5:test
[INFO] +- org.jboss.arquillian.protocol:arquillian-protocol-servlet:jar:1.0.0.CR4:test
[INFO] |  \- org.jboss.arquillian.container:arquillian-container-spi:jar:1.0.0.CR4:test
[INFO] |     \- org.jboss.shrinkwrap.descriptors:shrinkwrap-descriptors-api:jar:1.1.0-alpha-2:test
[INFO] +- org.owasp.esapi:esapi:jar:2.0.1:compile
[INFO] |  +- commons-configuration:commons-configuration:jar:1.5:compile
[INFO] |  |  +- commons-lang:commons-lang:jar:2.3:compile
[INFO] |  |  +- commons-logging:commons-logging:jar:1.1:compile
[INFO] |  |  |  +- logkit:logkit:jar:1.0.1:compile
[INFO] |  |  |  +- avalon-framework:avalon-framework:jar:4.1.3:compile
[INFO] |  |  |  \- javax.servlet:servlet-api:jar:2.3:compile
[INFO] |  |  \- commons-digester:commons-digester:jar:1.8:compile
[INFO] |  |     \- commons-beanutils:commons-beanutils:jar:1.7.0:compile
[INFO] |  +- commons-beanutils:commons-beanutils-core:jar:1.7.0:compile
[INFO] |  +- commons-fileupload:commons-fileupload:jar:1.2:compile
[INFO] |  +- commons-collections:commons-collections:jar:3.2:compile
[INFO] |  +- xom:xom:jar:1.1:compile
[INFO] |  |  +- xerces:xmlParserAPIs:jar:2.6.2:compile
[INFO] |  |  +- xerces:xercesImpl:jar:2.6.2:compile
[INFO] |  |  +- xalan:xalan:jar:2.7.0:compile
[INFO] |  |  |  \- xml-apis:xml-apis:jar:1.0.b2:compile
[INFO] |  |  \- jaxen:jaxen:jar:1.1-beta-8:compile
[INFO] |  |     +- dom4j:dom4j:jar:1.6.1:compile
[INFO] |  |     \- jdom:jdom:jar:1.0:compile
[INFO] |  +- org.beanshell:bsh-core:jar:2.0b4:compile
[INFO] |  \- org.owasp.antisamy:antisamy:jar:1.4.3:compile
[INFO] |     +- org.apache.xmlgraphics:batik-css:jar:1.7:compile
[INFO] |     |  +- org.apache.xmlgraphics:batik-ext:jar:1.7:compile
[INFO] |     |  +- org.apache.xmlgraphics:batik-util:jar:1.7:compile
[INFO] |     |  \- xml-apis:xml-apis-ext:jar:1.3.04:compile
[INFO] |     +- net.sourceforge.nekohtml:nekohtml:jar:1.9.12:compile
[INFO] |     \- commons-httpclient:commons-httpclient:jar:3.1:compile
[INFO] |        \- commons-codec:commons-codec:jar:1.2:compile
[INFO] +- com.sun.faces:jsf-api:jar:2.1.7:compile
[INFO] \- joda-time:joda-time:jar:1.6:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8 seconds
[INFO] Finished at: Wed Mar 14 23:17:07 CET 2012
[INFO] Final Memory: 29M/342M
[INFO] ------------------------------------------------------------------------

検索結果はあまり役に立ちません...

誰もがこの問題を知っていますか?(またはとにかく助けることができますか?)ありがとう!

4

2 に答える 2

2

変化する

org.owasp.esapi.reference.JavaEncryptor

org.owasp.esapi.reference.crypto.JavaEncryptor
于 2012-03-15T12:22:20.620 に答える
1

これはよくある間違いですが、codepitbullが答えを釘付けにしました。

この問題は通常、以前のバージョンのESAPI.propertiesファイルを使用したことが原因で発生します。ある時点で(後の2.0リリース候補IIRCの1つで)、いくつかのESAPI暗号クラスを再編成し、org.owasp.esapi.reference.cryptoパッケージを作成して、JavaEncryptorクラスをそれに移動しました。ある意味、これは良いことです。ESAPI1.4.xのESAPI.propertiesファイルを使用しようとすると、ESAPI2.0.x暗号の使用が一般的に明白な方法で失敗するためです。ESAPI 2.0.xと1.4.xの間でクラス名が同じである場合でも、暗号化/復号化の試行は失敗しますが、はるかに微妙な方法で失敗します。

于 2013-02-09T03:55:47.323 に答える