Mailinglisten-Archive |
Hallo! Ich kriege verschlüsselte Daten per POST übermittelt, sie haben drei Parameter: ---------------------------------------------------------------------------- -------------------------- 1/key This parameter will contain a AES key (symmetric key cryptography) that will be cyphered with the RSA public key of your server. This way, we will be able to create an AES key to cypher the informations in a way far more efficient that it would if we use public key algorithm to cypher all the informations. Cypher it using you RSA public key ensures us that only you will be able to uncypher these informations. 2/infos This parameter will store the informations of the user. These informations has been cyphered using the AES key sent in the first parameter. 3/sign This parameter will contain a signature cyphered with our private RSA key. This will ensure you can verify the messages to be sure that we sent the message, and not anyone else. Public.key contains the public RSA key you need to use to decrypt the "sign" parameter. externalPrivate.key contains your private RSA key "simulated" that you need to use to decrypt the "key" parameter. externalPublic.key contains your public RSA key "simultaed" that we used to crypt the "key" parameter. It is of no use for you here, but I give it to you for information purpose. Be aware these files should be read in raw byte. Please also note that all parameters are bytes written using an hex string notation. ---------------------------------------------------------------------------- -------------------------- The key in itself do not have much utility. Just read the bytes in the file with the program that will decrypt the infos. This is the code we use in Java, but the approach should be the same in PHP InputStream keyPublicKeyStream = new FileInputStream("Public.key"); byte[] keyPublicKeyByteArray = StreamUtils.read(keyPublicKeyStream); keyPublicKey = new RSAPublicKeyImpl(keyPublicKeyByteArray); The first line opens the file as a stream, the second line read the bytes, and the third build an object of a Java library that eases the decryption, and that is able to build the key from its bytes. There should be a utility library in PHP that does approximatively the same. ---------------------------------------------------------------------------- -------------------------- The bytes in the files are used as specifications to build a KeyFactory that will then be able to generate the objects you need. I think this should be the same behaviour than in your library. This is obviously a more "standard" way to get the keys out of the private key file. The specifications used to generate the keys is "PKCS8". ---------------------------------------------------------------------------- -------------------------- Hat jemand eine Idee, wie ich die Daten in PHP decodiere? Die Post-Daten empfange ich problemlos. Aber ich weiß absolut nicht weiter! Ich bin für jede Hilfe unendlich dankbar!!! Viele Grüße, Christian
php::bar PHP Wiki - Listenarchive