[OT] SourceForge AddReleaseTask  
Author Message
znerd





PostPosted: 2003-10-2 21:07:00 Top

java-programmer, [OT] SourceForge AddReleaseTask Offtopic: A question about HTTPS / Java:


I'm writing an Ant task to automate the SourceForge 'Add release' procedure.
For this I'm using Jakarta Commons Net and HttpClient.

The task can be used in an Ant build file as follows:

<taskdef name="sfaddrelease"
classname="org.xins.util.ant.sourceforge.AddReleaseTask"
classpath="xins-common.jar:commons-net.jar:commons-httpclient.jar"
/>

<sfaddrelease
user="znerd"
password="${password}"
file="build/xins-${version}.tar.gz"
group="71598"
package="71219"
release="${version}"
/>

The login is done using HTTPS. The Commons HttpClient library supports this.
But apparently, the server is not trusted, because I get a
javax.net.ssl.SSLHandshakeException. The message is:

"java.security.cert.CertificateException: Could not find trusted
certificate"

Apparently, I need to get the certificate of sourceforge.net and store it in
a keystore. Perhaps I should use 'keytool -import' for this, in some way.

Questions:
* How do I get the certificate of sourceforge.net?
* How do I store it in a file so that Java will accept it?


Ernst

_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"
 
mriem





PostPosted: 2003-10-2 21:28:00 Top

java-programmer >> [OT] SourceForge AddReleaseTask Hi Ernst,

You can do 2 things. Either just disable certificate validation in Java.

See http://javaalmanac.com/egs/javax.net.ssl/TrustAll.html

Or adding the certificate

See http://javaalmanac.com/egs/javax.net.ssl/GetCert.html
See http://javaalmanac.com/egs/java.security/AddCert.html

Regards,
Manfred.

-----Original Message-----
From: email***@***.com
[mailto:email***@***.com] On Behalf Of Ernst de Haan
Sent: Thursday, October 02, 2003 3:07 PM
To: email***@***.com
Subject: [OT] SourceForge AddReleaseTask


Offtopic: A question about HTTPS / Java:


I'm writing an Ant task to automate the SourceForge 'Add release'
procedure.
For this I'm using Jakarta Commons Net and HttpClient.

The task can be used in an Ant build file as follows:

<taskdef name="sfaddrelease"
classname="org.xins.util.ant.sourceforge.AddReleaseTask"
classpath="xins-common.jar:commons-net.jar:commons-httpclient.jar"
/>

<sfaddrelease
user="znerd"
password="${password}"
file="build/xins-${version}.tar.gz"
group="71598"
package="71219"
release="${version}"
/>

The login is done using HTTPS. The Commons HttpClient library supports
this.
But apparently, the server is not trusted, because I get a
javax.net.ssl.SSLHandshakeException. The message is:

"java.security.cert.CertificateException: Could not find trusted
certificate"

Apparently, I need to get the certificate of sourceforge.net and store
it in
a keystore. Perhaps I should use 'keytool -import' for this, in some
way.

Questions:
* How do I get the certificate of sourceforge.net?
* How do I store it in a file so that Java will accept it?


Ernst

_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"

_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"
 
past





PostPosted: 2003-10-2 21:47:00 Top

java-programmer >> [OT] SourceForge AddReleaseTask Ernst de Haan wrote:

> Questions:
> * How do I get the certificate of sourceforge.net?

Usually, I use a browser to connect to the https site, and then export
the certificate to a file.

> * How do I store it in a file so that Java will accept it?

keytool -import -keystore [keystore-file]

Cheers,
--
Panagiotis Astithas
Electrical & Computer Engineer, PhD
Network Management Center
National Technical University of Athens, Greece

_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"
 
 
ernst.dehaan





PostPosted: 2003-10-2 21:59:00 Top

java-programmer >> [OT] SourceForge AddReleaseTask
--Boundary-00=_O8Cf/EV4ajtYq+t
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Manfred,

Thanks for the quick reply!

/me considers buying this Java Almanac book

> See http://javaalmanac.com/egs/javax.net.ssl/TrustAll.html

I've tried this and it doesn't seem to work. See attached file for the
source code.

> Or adding the certificate
>
> See http://javaalmanac.com/egs/javax.net.ssl/GetCert.html
> See http://javaalmanac.com/egs/java.security/AddCert.html

I'll try this next...


Ernst

--Boundary-00=_O8Cf/EV4ajtYq+t
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"

--Boundary-00=_O8Cf/EV4ajtYq+t--

 
 
ernst.dehaan





PostPosted: 2003-10-2 22:13:00 Top

java-programmer >> [OT] SourceForge AddReleaseTask
--Boundary-00=_DKDf/8VLx/F4T9v
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

> See http://javaalmanac.com/egs/javax.net.ssl/GetCert.html

This doesn't seem to work for me:

java -cp ${CLASSPATH}:build/xins-common.jar
org.xins.tools.security.FetchCertificate sourceforge.net
Exception in thread "main" javax.net.ssl.SSLHandshakeException:
java.security.cert.CertificateException: Could not find trusted certificate
at com.sun.net.ssl.internal.ssl.BaseSSLSocketImpl.a(DashoA6275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
at com.sun.net.ssl.internal.ssl.SunJSSE_az.a(DashoA6275)
at com.sun.net.ssl.internal.ssl.SunJSSE_az.a(DashoA6275)
at com.sun.net.ssl.internal.ssl.SunJSSE_ax.a(DashoA6275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.j(DashoA6275)
at
com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(DashoA6275)
at
org.xins.tools.security.FetchCertificate.main(FetchCertificate.java:42)
Caused by: java.security.cert.CertificateException: Could not find trusted
certificate
at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.a(DashoA6275)
at
com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(DashoA6275)
at
com.sun.net.ssl.internal.ssl.JsseX509TrustManager.checkServerTrusted(DashoA6275)
... 7 more

See the attaches source code. That should do the trick, shouldn't it?

Ernst

--Boundary-00=_DKDf/8VLx/F4T9v
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"

--Boundary-00=_DKDf/8VLx/F4T9v--

 
 
ernst.dehaan





PostPosted: 2003-10-2 22:17:00 Top

java-programmer >> [OT] SourceForge AddReleaseTask Argh. The attachement got swallowed by java@ again. It's available here:

http://people.freebsd.org/~znerd/FetchCertificate.java

Ernst

On donderdag 2 oktober 2003 16:13, Ernst de Haan wrote:
> > See http://javaalmanac.com/egs/javax.net.ssl/GetCert.html
>
> This doesn't seem to work for me:
>
> java -cp ${CLASSPATH}:build/xins-common.jar
> org.xins.tools.security.FetchCertificate sourceforge.net
> Exception in thread "main" javax.net.ssl.SSLHandshakeException:
> java.security.cert.CertificateException: Could not find trusted
> certificate at
> com.sun.net.ssl.internal.ssl.BaseSSLSocketImpl.a(DashoA6275) at
> com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275) at
> com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275) at
> com.sun.net.ssl.internal.ssl.SunJSSE_az.a(DashoA6275) at
> com.sun.net.ssl.internal.ssl.SunJSSE_az.a(DashoA6275) at
> com.sun.net.ssl.internal.ssl.SunJSSE_ax.a(DashoA6275) at
> com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275) at
> com.sun.net.ssl.internal.ssl.SSLSocketImpl.j(DashoA6275) at
> com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(DashoA6275)
> at
> org.xins.tools.security.FetchCertificate.main(FetchCertificate.java:42)
> Caused by: java.security.cert.CertificateException: Could not find
> trusted certificate
> at
> com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.a(DashoA6275) at
> com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(Dash
>oA6275) at
> com.sun.net.ssl.internal.ssl.JsseX509TrustManager.checkServerTrusted(Dash
>oA6275) ... 7 more
>
> See the attaches source code. That should do the trick, shouldn't it?
>
> Ernst

_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"
 
 
ernst.dehaan





PostPosted: 2003-10-2 22:28:00 Top

java-programmer >> [OT] SourceForge AddReleaseTask The certificate fetching does work now. I'm disabling the SSL certificate
validation first, and then I can get the SSL certificates.

I'm uploading the new source file to:
http://people.freebsd.org/~znerd/FetchCertificate.java

Below is the output I get for sourceforge.net.

$ java -cp ${CLASSPATH}:build/xins-common.jar
org.xins.tools.security.FetchCertificate sourceforge.net
Fetched 1 certificate(s).
CERTIFICATE #0: [
[
Version: V3
Subject: CN=sourceforge.net, OU=Domain Control Validated, OU=See
www.geotrust.com/quickssl/cps (c)03, OU=Business Registration: https://
services.choicepoint.net/get.jsp?3754508056, O=sourceforge.net, C=US
Signature Algorithm: SHA1withRSA, OID = 1.2.840.113549.1.1.5

Key: com.sun.net.ssl.internal.ssl.JSA_RSAPublicKey@1fd
Validity: [From: Wed Apr 09 00:24:14 GMT 2003,
To: Sat Apr 09 00:24:14 GMT 2005]
Issuer: OU=Equifax Secure Certificate Authority, O=Equifax, C=US
SerialNumber: [ 03be4c]

Certificate Extensions: 6
[1]: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: E7 E3 00 04 63 28 23 3C 82 64 5B 6C FA F9 80 4D ....c(#<.d[l...M
0010: BA AF EF 4E ...N
]
]

[2]: ObjectId: 2.16.840.1.113730.1.1 Criticality=false
NetscapeCertType [
SSL server
]

[3]: ObjectId: 2.5.29.35 Criticality=false
AuthorityKeyIdentifier [
KeyIdentifier [
0000: 48 E6 68 F9 2B D2 B2 95 D7 47 D8 23 20 10 4F 33 H.h.+....G.# .O3
0010: 98 90 9F D4 ....
]

]

[4]: ObjectId: 2.5.29.31 Criticality=false
Extension unknown: DER encoded OCTET string =
0000: 04 33 30 31 30 2F A0 2D A0 2B 86 29 68 74 74 70 .3010/.-.+.)http
0010: 3A 2F 2F 63 72 6C 2E 67 65 6F 74 72 75 73 74 2E ://crl.geotrust.
0020: 63 6F 6D 2F 63 72 6C 73 2F 73 65 63 75 72 65 63 com/crls/securec
0030: 61 2E 63 72 6C a.crl


[5]: ObjectId: 2.5.29.37 Criticality=false
ExtendedKeyUsages [
[1.3.6.1.5.5.7.3.1]]

[6]: ObjectId: 2.5.29.15 Criticality=true
KeyUsage [
DigitalSignature
Non_repudiation
Key_Encipherment
Data_Encipherment
]

]
Algorithm: [SHA1withRSA]
Signature:
0000: 1E 80 38 DA 35 F7 FE 93 E1 A3 F8 DE 88 6D 88 64 ..8.5........m.d
0010: 1B 13 AD C4 94 E8 17 4B 98 65 C7 8C 10 81 05 A8 .......K.e......
0020: EE 46 F6 96 AE 8C 34 8C DF F7 EE E6 D6 9D 11 22 .F....4........"
0030: 54 C2 89 51 87 AB C4 CB F5 DA CB C3 5F 52 5B B9 T..Q........_R[.
0040: 2D C3 8C 26 D4 E8 B4 0C D3 62 3A 4B 3E F0 5D DB -..&.....b:K>.].
0050: 7A C5 AB 6D 85 D3 07 50 B2 94 38 BE 30 DD A0 42 z..m...P..8.0..B
0060: 13 F7 F3 7A 40 0A 63 61 86 0E 9B DA BB 4D 64 32 ...z@.ca.....Md2
0070: 2A 2E 9A E0 EA 8E 96 C1 05 61 C0 32 41 FC D6 63 *........a.2A..c

]

_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"