PayU-EMEA / apple-pay

This library is used to decode tokens for Apple Pay.
48 stars 31 forks source link

Unable to load PKCS7 object. Can't get certificates #20

Closed NDQuattro closed 3 years ago

NDQuattro commented 3 years ago

I'm getting 'Can't get certificates' error. stack trace: OpenSslService.php public function getCertificatesFromPkcs7($certificatePath) { $getCertificatesCommand = ['openssl', 'pkcs7', '-inform', 'DER', '-in', $certificatePath, '-print_certs']; $commandOutput = $this->runCommand($getCertificatesCommand); // This gives me 'Unable to load PKCS7 object'. I've tested it outside the script, storing $certificatePath file. }

PKCS7SignatureValidator.php private function extractCertificates($signature) { $pkcs7TemporaryFile = $this->temporaryFileService->createFile($signature); $certificates = $this->openSslService->getCertificatesFromPkcs7($pkcs7TemporaryFile->getPath()); } public function validate(array $paymentData, $rootCertificatePath, $signatureExpirationTime) { $signature = base64_decode($paymentData['signature']); $certificates = $this->extractCertificates($signature); }

Could you please guide me in the right direction? As far as I can see, either my paymentData is wrong or that $signature saved into the file is not of *.p7b format (PKCS7)

NDQuattro commented 3 years ago

Yes, my paymentData was wrong. I did not escape the '+' symbol.