Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebGateway doesn't support RSA private keys without tweaking. #6

Open
Rgrable opened this issue Sep 19, 2017 · 1 comment
Open

WebGateway doesn't support RSA private keys without tweaking. #6

Rgrable opened this issue Sep 19, 2017 · 1 comment

Comments

@Rgrable
Copy link

Rgrable commented Sep 19, 2017

Im unsure if it was meant to be that way, but the WebGateway and the WebPurchaseRequest do not have support for RSA private keys. When signing in the WebPurchaseRequest, the algorithm is hardcoded to only accept MD5. I got around this temporarily by changing the line from this:

$data['sign'] = Helper::sign($data, 'MD5', $this->getKey());

to this:

$data['sign'] = Helper::sign($data, $this->getSignType(), $this->getKey());

Now its able to create the transaction, but Im worried about the notify not being able to process the purchase with a private key.

@lokielse
Copy link
Owner

@Rgrable

I'm sorry to tell you that there is no RSA implemention of omnipay-global-alipay.

The complete purchase process need a alipay_public_key parameter

You should change the code at CompletePurchaseRequest.php#L16

$sign = Helper::sign($data, $signType, $this->getSignKey($signType));

to Signer.php#L240

$res = openssl_pkey_get_public($alipayPublicKey);
$match = (bool) openssl_verify($content, base64_decode($sign), $res, OPENSSL_ALGO_SHA1);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants