Catch DecoderException in the tcg_rim_tool CredentialParser class.

This commit is contained in:
chubtub 2021-06-10 12:34:38 -04:00
parent 71ec0cbd97
commit 3accb244e9

View File

@ -10,6 +10,7 @@ import org.bouncycastle.openssl.PEMKeyPair;
import org.bouncycastle.openssl.PEMParser;
import org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter;
import org.bouncycastle.util.encoders.Base64;
import org.bouncycastle.util.encoders.DecoderException;
import java.io.*;
import java.security.*;
@ -154,6 +155,8 @@ public class CredentialParser {
}
} catch (FileNotFoundException e) {
System.out.println("Unable to locate private key file: " + filename);
} catch (DecoderException e) {
System.out.println("Failed to parse uploaded pem file: " + e.getMessage());
} catch (NoSuchAlgorithmException e) {
System.out.println("Unable to instantiate KeyFactory with algorithm: " + algorithm);
} catch (IOException e) {