public PrivateKey getPrivateKeyFromString ( String key ) throws MangooEncryptionException { Objects . requireNonNull ( key , Required . KEY . toString ( ) ) ; try { return KeyFactory . getInstance ( ALGORITHM ) . generatePrivate ( new PKCS8EncodedKeySpec ( decodeBase64 ( key ) ) ) ; } catch ( InvalidKeySpecException | NoSuchAlgorithmException e ) { throw new MangooEncryptionException ( "Failed to get private key from string" , e ) ; } }
Generates Private Key from Base64 encoded string