Componentix logo

Componentix blog

Here we write some random thoughts and articles about software development: Java, Grails, Node.js, iPhone, iPad and more.

Nimble – easy user profiles and security for Grails

Recently found a really nice Grails plugin – Nimble.

It provides a complete solution for user profiles management, flexible authentication (both local and using OpenID) and fine-grained access control. It is based on Apache Shiro, which we used previously for authentication/access control.

I will try to use it in some simple project and then write a blog post describing my experience.

Offtopic: This is verification code for Technorati – QAEYYR9THPUN

Using cryptographically strong random number generator with SecureRandom in Java

There might be a need occasionally to generate sequences of random numbers in your real-world programs. While there is a special class in Java to deal just with that — java.util.Random — it’s not cryptographically strong, and the numbers chosen are not completely random because a definite mathematical algorithm (based on Donald E. Knuth’s subtractive random number generator algorithm) is used to select them. Therefore it is not safe to use this class for tasks that require high level of security, like creating a random password, for example.

Fortunately, there’s another, much more cryptographically strong random number generator provided with every Java Runtime Environment by default. It can be accessed via the java.security.SecureRandom class, which is a subclass of class Random mentioned above. That means that you can use it the same way you did when you used the generator implemented by the Random class, it even allows you to set the random seed of your choice if it happens so that you need to repeat the sequence of numbers generated, which is good as for example the .NET equivalent — System.Security.Cryptography.RNGCryptoServiceProvider — does not allow to do that. However, there is one or two issues that, if not addressed, might turn into real problems and cause lots of headaches. But before I describe those, let me talk you into how to start using this strong random number generator.

Read more...
Following e-mail is only for robots (never send anything to it, or you would be blacklisted): botsonly@componentix.com