Showing posts with label mac. Show all posts
Showing posts with label mac. Show all posts

Monday, April 4, 2011

NoSuchAlgorithmException: SunTlsRsaPremasterSecret after Java upgrade on Mac OS X

I've this weird problem after upgrading to new Java version on Mac. My (maven) project ran OK from command line but got the "SunTlsRsaPremasterSecret" error in Eclipse.
Caused by: java.security.NoSuchAlgorithmException: SunTlsRsaPremasterSecret KeyGenerator not available
at javax.crypto.KeyGenerator.<init>(DashoA13*..)
at javax.crypto.KeyGenerator.getInstance(DashoA13*..)
at com.sun.net.ssl.internal.ssl.JsseJce.getKeyGenerator(JsseJce.java:223)
at com.sun.net.ssl.internal.ssl.RSAClientKeyExchange.<init>(RSAClientKeyExchange.java:89)
The solution was to remove Installed JREs in Eclipse configuration and add them again (using the "Search..." button).

Thursday, May 20, 2010

Java for Mac OS X 10.5 Update 7 causes problem with Eclipse SVN

Yesterday I updated my Mac Java version to Update 7 - it's always better to use new things, isn't it ? :) Alas, after the upgrade my Eclipse Subversion plugin stopped working - every attempt of interaction with SVN (browsing, commit etc) caused freezing.

After long and painful investigation I've narrowed the problem: it occurs when using SVNKit with some (not all) SVN servers that use HTTPS client certificate authentication. It turned out that Java Update 7 fixes a security vulnerability by disabling SSL renegotiation. As the server tries to renegotiate SSL session and client (using JSSE) refuses, the whole process enters infinite loop with SVNKit log showing "javax.net.ssl.SSLHandshakeException: renegotiation is not allowed".

The workaround is to re-enable SSL renegotiation in JSEE (yes, this means exposing yourself to the vulnerability again). To do this, set the JVM option allowUnsafeRenegotiation:

-Dsun.security.ssl.allowUnsafeRenegotiation=true
In case of Eclipse, it can be set in eclipse.ini.

Sunday, March 16, 2008

Timed Screenshots on Mac

When working as a time-based contractor, recording spent time in "time manager" is sometimes problematic and always tedious. It happened to me that at the end of the day I have trouble recalling what tasks did I do and it what proportions. Now maybe this little shell script can help me:

#!/bin/bash 
# Makes screenshots every $PERIOD minutes 
# and puts them into /var/tmp/screens/ directory.  

PERIOD=5  
for ((i=0; i<=10*60/PERIOD; i+=1)); do
    FILENAME=/var/tmp/screens/screen`date +%y%m%d_%H%M`.png
    echo Capturing $FILENAME...
    screencapture $FILENAME
    echo Done, next capture in $(($PERIOD*60)) seconds.
    sleep $(($PERIOD*60))
done