You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@clerezza.apache.org by re...@apache.org on 2010/06/18 19:31:21 UTC
svn commit: r956056 - in
/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.foafssl/core:
./ src/main/scala/org/apache/clerezza/foafssl/
src/main/scala/org/apache/clerezza/foafssl/ssl/
Author: reto
Date: Fri Jun 18 17:31:20 2010
New Revision: 956056
URL: http://svn.apache.org/viewvc?rev=956056&view=rev
Log:
CLEREZZA-93: removed dependency on artifact not in maven central, fixed licenses
Modified:
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.foafssl/core/pom.xml
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.foafssl/core/src/main/scala/org/apache/clerezza/foafssl/CertUtilities.scala
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.foafssl/core/src/main/scala/org/apache/clerezza/foafssl/WebDescriptionProvider.scala
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.foafssl/core/src/main/scala/org/apache/clerezza/foafssl/ssl/Activator.scala
Modified: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.foafssl/core/pom.xml
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.foafssl/core/pom.xml?rev=956056&r1=956055&r2=956056&view=diff
==============================================================================
--- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.foafssl/core/pom.xml (original)
+++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.foafssl/core/pom.xml Fri Jun 18 17:31:20 2010
@@ -46,11 +46,6 @@
<artifactId>jsr311-api</artifactId>
</dependency>
<dependency>
- <groupId>net.java.dev.sommer</groupId>
- <version>0.5-SNAPSHOT</version>
- <artifactId>foafssl-verifier</artifactId>
- </dependency>
- <dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
</dependency>
Modified: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.foafssl/core/src/main/scala/org/apache/clerezza/foafssl/CertUtilities.scala
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.foafssl/core/src/main/scala/org/apache/clerezza/foafssl/CertUtilities.scala?rev=956056&r1=956055&r2=956056&view=diff
==============================================================================
--- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.foafssl/core/src/main/scala/org/apache/clerezza/foafssl/CertUtilities.scala (original)
+++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.foafssl/core/src/main/scala/org/apache/clerezza/foafssl/CertUtilities.scala Fri Jun 18 17:31:20 2010
@@ -1,33 +1,76 @@
/*
- * Copyright 2010 reto.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * under the License.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
package org.apache.clerezza.foafssl
import java.security.cert.X509Certificate
-import net.java.dev.sommer.foafssl.claims.X509Claim
import org.apache.clerezza.rdf.core.UriRef
+/**
+ * Utilitie functions to deal with certificates
+ *
+ * @author Reto Bachmann-Gmür, Henry Story
+ */
object CertUtilities {
- def getClaimedWebIds(certificates: Array[X509Certificate]) = {
- val x509Claim = new X509Claim(certificates(0))
- import scala.collection.JavaConversions._
- val webIdUriRefs = for (uri <- X509Claim.getAlternativeURIName(certificates(0))) yield {
- new UriRef(uri.toString)
+
+ /**
+ * same as getClaimedWebIds(chain(0))
+ */
+ def getClaimedWebIds(chain: Array[X509Certificate]): List[UriRef] = {
+ getClaimedWebIds(chain(0))
+ }
+
+
+ /**
+ * Extracts the URIs in the subject alternative name extension of an X.509
+ * certificate (perhaps others such as email addresses could also be
+ * useful).
+ *
+ * @param cert
+ * X.509 certificate from which to extract the URIs.
+ * @return list of java.net.URIs built from the URIs in the subjectAltName
+ * extension.
+ */
+ def getClaimedWebIds(cert: X509Certificate): List[UriRef] = {
+ // throws CertificateParsingException {
+ var result : List[UriRef] = Nil
+ if (cert == null) {
+ return result;
}
- webIdUriRefs
+
+ val names = cert.getSubjectAlternativeNames()
+ if (names == null) {
+ return result;
+ }
+
+ // val n = names(0)
+ import scala.collection.mutable
+ val it = names.iterator;
+ while (it.hasNext) {
+ val altNme = it.next()
+ val altTpe = altNme.get(0);
+ val altObj = altNme.get(1);
+ if ((altTpe.asInstanceOf[Integer] == 6) && altObj.isInstanceOf[String]) {
+ result = new UriRef(altObj.asInstanceOf[String]) :: result;
+ }
+ }
+ return result
}
-}
+
+}
\ No newline at end of file
Modified: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.foafssl/core/src/main/scala/org/apache/clerezza/foafssl/WebDescriptionProvider.scala
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.foafssl/core/src/main/scala/org/apache/clerezza/foafssl/WebDescriptionProvider.scala?rev=956056&r1=956055&r2=956056&view=diff
==============================================================================
--- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.foafssl/core/src/main/scala/org/apache/clerezza/foafssl/WebDescriptionProvider.scala (original)
+++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.foafssl/core/src/main/scala/org/apache/clerezza/foafssl/WebDescriptionProvider.scala Fri Jun 18 17:31:20 2010
@@ -1,18 +1,20 @@
/*
- * Copyright 2010 reto.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * under the License.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
package org.apache.clerezza.foafssl
Modified: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.foafssl/core/src/main/scala/org/apache/clerezza/foafssl/ssl/Activator.scala
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.foafssl/core/src/main/scala/org/apache/clerezza/foafssl/ssl/Activator.scala?rev=956056&r1=956055&r2=956056&view=diff
==============================================================================
--- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.foafssl/core/src/main/scala/org/apache/clerezza/foafssl/ssl/Activator.scala (original)
+++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.foafssl/core/src/main/scala/org/apache/clerezza/foafssl/ssl/Activator.scala Fri Jun 18 17:31:20 2010
@@ -53,6 +53,7 @@ class Activator() {
protected def activate(context: ComponentContext) = {
val bundleContext = context.getBundleContext
+ //TODO set jvm default ca-store
val sslContextFactory = new X509SSLContextFactory(
getServerCertKeyStore(context), getKeyStorePassword(bundleContext),
getServerCertKeyStore(context));//getCaKeyStore());
@@ -65,13 +66,6 @@ class Activator() {
println("Registered SSLContext+")
}
- def getCaKeyStore() : KeyStore = {
- val ks = KeyStore.getInstance("JKS");
- val ksis = new FileInputStream("/home/reto/cacert.jks");
- ks.load(ksis, "testtest".toCharArray());
- ksis.close();
- return ks;
- }
def getServerCertKeyStore(context: ComponentContext): KeyStore = {
val bundleContext = context.getBundleContext