Jump to content
php.lv forumi

Norvik BankLink


aaxc

Recommended Posts

Sveiki,

esmu mazliet iestrēdzis ar Norvik bankas banklinku. Itkā vis ir sataisīts, bet brēc ka signature ir nepareiza.

 

Lūk bankas atsūtītais "manuālis":

Digital signature MAC is XML data hash value, encrypted with sender’s private key.
For hash value calculations SHA-1 algorithm is used, but for signature calculation RSA algorithm is used. Digital signature transforms to textual format using BASE64 encoding and is placed to MAC field.

Mans kods:

private function setPrivateKey ( $key_name ) {
 $fp = fopen( $this -> getKeyLocation() . '/' . $key_name, "r" );
 $priv_key = fread( $fp, 8192 );
 fclose( $fp );
 $this -> private_key = openssl_get_privatekey( $priv_key );
}

private function setSignature () {
 $pre_mac = sha1( $this -> getXMLData() );
 openssl_sign( $pre_mac, $signature, $this -> getPrivateKey() );
 $this -> signature = $signature;
}

private function setMac () {
 $this -> mac = base64_encode( $this -> getSignature() );
}

Vai es kautko ne tā taisu? Itkā jau viss pēc manuāļa, bet signature šamajiem nepatīk. Ar citām bankām šādu problēmu nav, vis strādā normāli.

 

Ja kāds ir taisījis Norvik bankai tieši, varētu padalīties ar pieredzi.

 

Paldies jau iepriekš.

Edited by aaxc
Link to comment
Share on other sites

<pre class="prettyprint" style="margin-top: 0px; margin-bottom: 0px; margin-left: 10px; padding: 5px; background-color: rgb(248, 248, 248); border: 1px solid rgb(201, 201, 201); overflow: auto; font-size: 11px; line-height: 15px; color: rgb(40, 40, 40); ">getSignature</pre>

 

kas te?

Link to comment
Share on other sites

private function setSignature () {
 $pre_mac = sha1( $this -> getXMLData() );
 openssl_sign( $pre_mac, $signature, $this -> getPrivateKey() );
 $this -> signature = $signature;
}

Ka redzi sākumā notiek sha1 un pēc tam sign, tākā sanāk openssl_sign( sha1( data ) )

Link to comment
Share on other sites

Ok, problem solved, kādām būtu jāiemāca rakstīt manuāļus ... novācu lieki pieminēto hashingu un vis aizgāja:

 

private function setSignature () {
 openssl_sign( $this -> getXMLData(), $signature, $this -> getPrivateKey() );
 $this -> signature = $signature;
}

Link to comment
Share on other sites

Manuālis aizkavējies, jo nezkāpēc nestrādā prod versija. Ar demo sistēmu vis šancē perfekti. Palaižot live kautkas nav tā. Gaidu jau gandrīz 2 nedēļas no bankas atbildi :)

Edited by aaxc
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...