Sud Umm wrote:It works fine only on Windows platform, but not on others.
You can't use SecureRandom in the way you are doing it. SecureRandom does NOT only use your seed to initialize itself, it also may seek to use other sources of entropy. This should be made clear in the Javadocs for SecureRandom; unfortunately it is not.
You should use a proper Password-based encryption (PBE) scheme.
About the exception handling: use BadPaddingException and then GeneralSecurityException - and convert at least the last one into a InvalidStateException. You can avoid the encoding exceptions by using Charset.forName() in later VM's. Note that any encoding is accepted by default, the exception normally only gets thrown if the encoding is not available; but Java specifies that "UTF-8" is ALWAYS available, so that's a bit of a moot point.