Décerné

PHP CC Encryption script needed

The end game is to create the string that goes in the XML Tag <din:EncryptedCard>, which can be found in two of the SOAP requests: AddCardTransaction and CommitPendingTicketWithCard. We are most likely going to be using AddCardTransaction.

The string inside of the tag must be in the form <encrypted key=\"ENCRYPTED_SYMETRIC_KEY\">ENCRYPTED_CARD</encrypted>

An example request looks like this:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:din="http://schemas.datacontract.org/2004/07/Dinerware.API.v01">

<soapenv:Header/>

<soapenv:Body>

<tem:AddCardTransaction>

<!--Optional:-->

<tem:ticketID>55622</tem:ticketID>

<tem:theCardTransaction>

<din:EncryptedCard><encrypted key="UMk9IvmMmdwXakF82yUFGanuP4NUWehk9sZ/jGbsYVR7doWou+5rgeAgFKJTpCcOsbKSDj01aPpE9kP54O/Q5w==">Rw7wBMNoIedWyizn+qwH/7BFQuN1C6H5f8MYsJCrqKiaBPRmUtmec1VWFbri+R7GYpsuwmaQVjmXbfoavwYum+E5sZc1gQyVuETqDuauNSqizmY74UWX3brsxl6GpGrTxZKlLr9MIGzKaiKmGS+1MbIA9hKr/RHUMCEcLpqHdY/OU1Rj7kmdfPMtanFqU9Z57cA0LkKljhxIE2eKuDVk/1nF+w5845cPcpRTMqBklfIkHY0LuuOtOn6EaMms1y0o0uqE14YOQMyUDX+fWsfo17JGNDzxX2ytxF+YXgvZt6jlmG98Ym+1IkadSsK7HrYBfAseopvQD44=</encrypted></din:EncryptedCard>

<!--Optional:-->

<din:PaymentAmount>9.00</din:PaymentAmount>

<!--Optional:-->

<din:TaxAmount>0.25</din:TaxAmount>

<!--Optional:-->

<din:TipAmount>0.50</din:TipAmount>

</tem:theCardTransaction>

</tem:AddCardTransaction>

</soapenv:Body>

</soapenv:Envelope>

The Encryption to output the string above works as follows:

Get PublicKey (in xml format: <RSAKeyValue><Modulus>oQFacRxwZ2goA5U2UbEDt0e2pjPF2SrO8nJ0vz+h70BQ5yc1XaIB3KwPS8Klsojd/UXgbuZbEJ/RxHNrRUtgIQ==</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>)

Get CVV, cardNum, expMonth, expYear, avrZip (card info)

Create string with card info like so:

<Card xmlns=\"[url removed, login to view]\" xmlns:i=\"[url removed, login to view]\"><CVV>CVV</CVV><CardNumber>cardNum</CardNumber><ExpMonth>expMonth</ExpMonth><ExpYear>expYear</ExpYear><AvrZip>avrZip</AvrZip></Card>

Generate a random IV

Generate a random Key

Use TripleDes with the Key and IV to encrypt the cardInfoString

Convert this to a Base64 String

Add Key and IV (in that order) to a 32 byte buffer

Encrypt this buffer with RSA using the obtained PublicKey

Convert the encrypted key to a Base64 string

Format a string with the encrypted card and symmetric key as mentioned above.

This for a restaurant POS system we are interfacing with.

Compétences : PHP

Voir plus : pos game, php end script, tem, symmetric, rsa, php pos, encryption, cc, byte, api pos, xml soap api, restaurant order form, php api soap, php tag, xmlns, php header script, convert php form, soap form, schemas, generate api key, rsa example, encrypted php, encryption rsa, add key, php system convert

Concernant l'employeur :
( 4 commentaires ) Manhattan, United States

N° du projet : #2362898

1 freelance a fait une offre moyenne de 20 $ pour ce travail

sanjay2004

Hired by the Employer

20 $ USD / heure
(421 Commentaires)
9.3