There is a good basic example here on encrypting a String with. This example uses DES but I belive the principle is the same and so will hopefully help get you started.
The Stack Trace you have posted is very similar to the issue faced in this post. There is an accepted answer there if you have a look which may provide you with a fix also.
Good luck!