public BurpCertificate importCertificateFromString(String inputString){
  setStatus("Importing certificate...");
  CertificateFactory certFactory;
  try {
    certFactory=CertificateFactory.getInstance("X.509");
    ByteArrayInputStream bais=new ByteArrayInputStream(Base64.decode(inputString));
    X509Certificate x509certificate=(X509Certificate)certFactory.generateCertificate(bais);
    BurpCertificate certificate=new BurpCertificate(x509certificate);
    certificate.setPublicKey(x509certificate.getPublicKey());
    certificate.setSource("Imported");
    burpCertificateStore.addCertificate(certificate);
    setCertificateTree();
    setStatus("Certificate imported");
    return certificate;
  }
 catch (  CertificateException|Base64DecodingException e) {
    setStatus("Error reading input certificate. (" + e.getMessage() + ")");
    e.printStackTrace();
  }
catch (  Exception e) {
    setStatus("Error. (" + e.getMessage() + ")");
    e.printStackTrace();
  }
  return null;
}

public BurpCertificate importCertificateFromString ( String inputString ) { setStatus ( "Importing certificate..." ) ; CertificateFactory certFactory ; try { certFactory = CertificateFactory . getInstance ( "X.509" ) ; ByteArrayInputStream bais = new ByteArrayInputStream ( Base64 . decode ( inputString ) ) ; X509Certificate x509certificate = ( X509Certificate ) certFactory . generateCertificate ( bais ) ; BurpCertificate certificate = new BurpCertificate ( x509certificate ) ; certificate . setPublicKey ( x509certificate . getPublicKey ( ) ) ; certificate . setSource ( "Imported" ) ; burpCertificateStore . addCertificate ( certificate ) ; setCertificateTree ( ) ; setStatus ( "Certificate imported" ) ; return certificate ; } catch ( CertificateException | Base64DecodingException e ) { setStatus ( "Error reading input certificate. (" + e . getMessage ( ) + ")" ) ; e . printStackTrace ( ) ; } catch ( Exception e ) { setStatus ( "Error. (" + e . getMessage ( ) + ")" ) ; e . printStackTrace ( ) ; } return null ; }
read an pem encoded x . 509v3 certificate
