Saturday, 28 March 2009

X509 certificate

This post shows how to generate a x509 certificate using keytool (jdk/bin), and import it from C#.

1) Use keytool to generate the public key, specifying for example keytool -genkeypair etc... -keyalg RSA -keysize 1024
2) Export the key into a X509 certificate: keytool -exportcert etc.. -rfc -file itsc.cer

If this works, on Windows, you can double-click on itsc.cer and you will see a nice window with the certificate information.

In C#, to import the certificate:


var streamReader = new StreamReader(@".....\itsc.cer");
string x509Str = streamReader.ReadToEnd();
streamReader.Close();
var x509Certificate = new X509Certificate2(Encoding.UTF8.GetBytes(x509Str));
RSACryptoServiceProvider rsaCryptoServiceProvider = (RSACryptoServiceProvider)x509Certificate.PublicKey.Key;


Back to Java.

What you need to do is to extract by code the private key from the keystore:


KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
keyStore.load(new FileInputStream(keyStorePath), "your password".toCharArray());
Key key = keyStore.getKey("your alias", "your password".toCharArray());

Sunday, 22 March 2009

IBM buys SUN

"Sun will bring a very large open source product line to IBM indeed, with the crown jewels in terms of popularity being MySQL and Java. IBM has its own DB2 product line and MySQL would compete with that - although one would think Big Blue's marketeers could separate the two fairly easily. MySQL might be targeted at SQL, for example. Big Blue might also make better revenue-generating use of Java."


Article on TheRegister.co.uk

Now that Java is open, the only question I would have would be Netbeans vs. Eclipse.
Does it make sense for IBM to have both knowing that the javax.swing.* are part of the core, yes, I would think, knowing that both technologies (SWT, SWING) might converge.

Saturday, 14 March 2009

A store that sells husbands

A store that sells new husbands has opened in New York City , where a
woman may go to choose a husband. Among the instructions at the entrance
is a description of how the store operates:

You may visit this store ONLY ONCE! There are six floors and the value
of the products increase as the shopper ascends the flights. The shopper
may choose any item from a particular floor, or may choose to go up to
the next floor, but you cannot go back down except to exit the building!

So, a woman goes to the Husband Store to find a husband. On the first
floor the sign on the door reads:

Floor 1 - These men Have Jobs

She is intrigued, but continues to the second floor, where the sign
reads:

Floor 2 - These men Have Jobs and Love Kids.

'That's nice,' she thinks, 'but I want more.'

So she continues upward. The third floor sign reads:

Floor 3 - These men Have Jobs, Love Kids, and are Extremely Good
Looking.

'Wow,' she thinks, but feels compelled to keep going.

She goes to the fourth floor and the sign reads:

Floor 4 - These men Have Jobs, Love Kids, are Drop-dead Good Looking and
Help With Housework.

'Oh, mercy me!' she exclaims, 'I can hardly stand it!'

Still, she goes to the fifth floor and the sign reads:

Floor 5 - These men Have Jobs, Love Kids, are Drop-dead Gorgeous, Help
with Housework, and Have a Strong Romantic Streak.

She is so tempted to stay, but she goes to the sixth floor, where the
sign reads:

Floor 6 - You are visitor 31,456,012 to this floor. There are no men on
this floor. This floor exists solely as proof that women are impossible
to please. Thank you for shopping at the Husband Store.

Tuesday, 3 March 2009

Ryanair



and on top of this:


  • Breathing airplane O2: 10£

  • Usage of onboard toilets: 25£, add £10 for toilet paper

  • etc..

Blog Archive