private PKIXCertPathBuilderResult buildCertPath( boolean searchAllCertStores, List<List<Vertex>> adjList) throws CertPathBuilderException { // Init shared variables and build certification path pathCompleted = false; trustAnchor = null; finalPublicKey = null; policyTreeResult = null; LinkedList<X509Certificate> certPathList = new LinkedList<>(); try { buildForward(adjList, certPathList, searchAllCertStores); } catch (GeneralSecurityException | IOException e) { if (debug != null) { debug.println("SunCertPathBuilder.engineBuild() exception in " + "build"); e.printStackTrace(); } throw new SunCertPathBuilderException( "unable to find valid " + "certification path to requested target", e, new AdjacencyList(adjList)); } // construct SunCertPathBuilderResult try { if (pathCompleted) { if (debug != null) debug.println("SunCertPathBuilder.engineBuild() " + "pathCompleted"); // we must return a certpath which has the target // as the first cert in the certpath - i.e. reverse // the certPathList Collections.reverse(certPathList); return new SunCertPathBuilderResult( cf.generateCertPath(certPathList), trustAnchor, policyTreeResult, finalPublicKey, new AdjacencyList(adjList)); } } catch (CertificateException e) { if (debug != null) { debug.println("SunCertPathBuilder.engineBuild() exception " + "in wrap-up"); e.printStackTrace(); } throw new SunCertPathBuilderException( "unable to find valid " + "certification path to requested target", e, new AdjacencyList(adjList)); } return null; }
public GoogleDriveDownloadTask(String fileName) { if (DriveUtil.service == null) { try { DriveUtil.getDriveService(); } catch (GeneralSecurityException | IOException | URISyntaxException e) { MAMUtil.writeLog(e); e.printStackTrace(); } } ArrayList<String> fileList = new ArrayList<String>(); fileList.add(fileName); this.fileList = fileList; this.totalFileNumber = 1; }
public static Payload decode(String idTokenString) { GoogleIdTokenVerifier verifier = new GoogleIdTokenVerifier.Builder(transport, jsonFactory) .setAudience(Arrays.asList(CLIENT_ID)) .setIssuer(ISSUER) .build(); GoogleIdToken idToken = null; try { idToken = verifier.verify(idTokenString); return idToken == null ? null : idToken.getPayload(); } catch (GeneralSecurityException | IOException e) { e.printStackTrace(); return null; } }