Ejemplo n.º 1
0
 /**
  * Creates a PaymentSession from the provided {@link Protos.PaymentRequest}. If verifyPki is true,
  * also validates the signature and throws an exception if it fails. If trustStoreLoader is null,
  * the system default trust store is used.
  */
 public PaymentSession(
     Protos.PaymentRequest request,
     boolean verifyPki,
     @Nullable final TrustStoreLoader trustStoreLoader)
     throws PaymentProtocolException {
   TrustStoreLoader nonNullTrustStoreLoader =
       trustStoreLoader != null
           ? trustStoreLoader
           : new TrustStoreLoader.DefaultTrustStoreLoader();
   parsePaymentRequest(request);
   if (verifyPki) {
     try {
       pkiVerificationData =
           PaymentProtocol.verifyPaymentRequestPki(request, nonNullTrustStoreLoader.getKeyStore());
     } catch (IOException x) {
       throw new PaymentProtocolException(x);
     } catch (KeyStoreException x) {
       throw new PaymentProtocolException(x);
     }
   } else {
     pkiVerificationData = null;
   }
 }