private SecretKey retrieveKey ( ) { SecretKey key = null ; try { String workingDir = getMain ( ) . getFileSystemManager ( ) . getSystemLocation ( ) . getAbsolutePath ( ) ; final String keyStoreFile = workingDir + File . separator + "izou.keystore" ; KeyStore keyStore = createKeyStore ( keyStoreFile , "4b[X:+H4CS&avY<)" ) ; KeyStore . PasswordProtection keyPassword = new KeyStore . PasswordProtection ( "Ev45j>eP}QTR?K9_" . toCharArray ( ) ) ; KeyStore . Entry entry = keyStore . getEntry ( "izou_key" , keyPassword ) ; key = ( ( KeyStore . SecretKeyEntry ) entry ) . getSecretKey ( ) ; } catch ( NullPointerException e ) { return null ; } catch ( UnrecoverableEntryException | NoSuchAlgorithmException | KeyStoreException e ) { logger . error ( "Unable to retrieve key" , e ) ; } return key ; }
Retrieves the izou aes key stored in a keystore