Error when getting key from KeyStore (java) -
i'm facing weird error. error started happen today, working on friday, , nothing changed, @ least nothing know.
i have simple keystore store key encrypt data. testing created separate application handle this. code:
public static void main(string[] args) { properties prop = new properties(); try { prop.load(new fileinputstream("./security/security.properties")); string ksfile = prop.getproperty("ksfile"); string kspassword = prop.getproperty("kspassword"); string keyalias = prop.getproperty("keyalias"); string keypassword = prop.getproperty("keypassword"); prop.getproperty("carddataencryptionkey"); keystore ks; ks = keystore.getinstance("jceks"); fileinputstream fis = null; fis = new fileinputstream(ksfile); ks.load(fis, kspassword.tochararray()); // symmetric char[] keychararray = keypassword.tochararray(); protectionparameter proparam = new keystore.passwordprotection( keychararray ); keystore.entry entry = ks.getentry( keyalias, proparam ); secretkeyentry aeskey = (keystore.secretkeyentry) entry; aeskey.getsecretkey(); fis.close(); } catch (exception e) { e.printstacktrace(); } } code basic , open keystore configured in security.properties. problem i'm getting error in following line:
keystore.entry entry = ks.getentry( keyalias, proparam ); i repeat wasn't happening, started suddenly. file ok, paths ok, file opened, when try keyentry, i'm getting numberformatexception, don't have clue if what's going on. error stack trace:
test @ localhost:62013 thread [main] (suspended (exception numberformatexception)) owns: inetaddress$cache (id=58) owns: object (id=59) integer.parseint(string, int) line: not available integer.<init>(string) line: not available inetaddresscachepolicy.<clinit>() line: not available inetaddress$cache.getpolicy() line: not available inetaddress$cache.put(string, inetaddress[]) line: not available inetaddress.cacheinitifneeded() line: not available inetaddress.cacheaddresses(string, inetaddress[], boolean) line: not available inetaddress.getaddressesfromnameservice(string, inetaddress) line: not available inetaddress.getlocalhost() line: not available jarverifier.getsystementropy() line: 783 jarverifier.testsignatures(x509certificate, certificatefactory) line: 706 jarverifier.access$400(x509certificate, certificatefactory) line: 34 jarverifier$1.run() line: 183 jarverifier$1.run() line: 149 accesscontroller.doprivileged(privilegedexceptionaction<t>) line: not available [native method] jarverifier.<clinit>() line: 148 jcesecurity.loadpolicies(file, cryptopermissions, cryptopermissions) line: 316 jcesecurity.setupjurisdictionpolicies() line: 261 jcesecurity.access$000() line: 48 jcesecurity$1.run() line: 78 accesscontroller.doprivileged(privilegedexceptionaction<t>) line: not available [native method] jcesecurity.<clinit>() line: 76 jcesecuritymanager.<clinit>() line: 65 cipherforkeyprotector(cipher).<init>(cipherspi, provider, string) line: 252 cipherforkeyprotector.<init>(cipherspi, provider, string) line: 377 keyprotector.unseal(sealedobject) line: 347 jcekeystore.enginegetkey(string, char[]) line: 133 jcekeystore(keystorespi).enginegetentry(string, keystore$protectionparameter) line: not available keystore.getentry(string, keystore$protectionparameter) line: not available test.main(string[]) line: 39 please guys, give me light of hope! thank you!
finally eclipse problem, don't know why happened. started error after changed domain password, though restarted windows twice.
who knows! thanks.
Comments
Post a Comment