ideawu.com
域名年龄: 18年2个月2天HTTP/1.1 301 永久重定向 服务器:nginx/1.10.2 访问时间:2019年05月22日 10:25:21 类型:text/html Transfer-Encoding: chunked 连接:keep-alive 目标网址:http://www.ideawu.com/blog/ HTTP/1.1 200 OK 服务器:nginx/1.10.2 访问时间:2019年05月22日 10:25:21 类型:text/html; charset=UTF-8 Transfer-Encoding: chunked 连接:keep-alive X-Pingback: http://www.ideawu.com/blog/xmlrpc.php Content-Encoding: gzip 网站编码:UTF-8
idea's blogWeb and Mobile Software EngineerHomeWorksSSDBCpyToviAbout2015-05-07PHP decode C string-like encoded stringLinux C, PHPViews: 12960|No CommentsTo decode string encoded in C string-like to what it exactly was in memory, I write a PHP function.C string-like encoded string as like this:\r\n\x90The PHP function, unescape C string.function unescape_c_str($str){$ret = '';$len = strlen($str);for($i=0; $iPosted by ideawu at 2015-05-07 12:54:202015-02-03iOS Objective-C RSA encrypt with only public key and descrypt with PHPCocoaViews: 37361|13 CommentsIf you found this post via Google, I am sure this is the final link you click. Your problem will be solved with a single function without any dependency!You may have read these posts:Using an RSA public key generated by OpenSSL in iOSRSA Encryption in iOS and Decrypt It Using PHPThe first post helps, but it is too old, and it doesn’t provide the full code, the author is so mean!The second is nonsense, because you people finding this post must have the exact need as me: iOS RSA encrypt with ONLY the public key. NO .der file, NO CA, NO bullshit!OK, lets go on.You generate RSA public key and private key with PHP$config = array("digest_alg" => "sha512","private_key_bits" => 1024,"private_key_type" => OPENSSL_KEYTYPE_RSA,);$res = openssl_pkey_new($config);openssl_pkey_export($res, $privKey);$pubKey = openssl_pkey_get_details($res);$pubKey = $pubKey["key"];var_dump($privKey, $pubKey); // now you get keys in plain textIt is like:-----BEGIN PRIVATE KEY-----MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAMQKGp7zSUktNOQkPdfcvJ3sWP7O46ENmSO4s0+iDdhHbR7klyt2oj0gXM1sAJj8ZBWFudu8GpiDKqXwN88IZemfT5c1LEQshTD1WHfZC6EY2vf9MGl5yGtV5WkU8vDJpg0STUJrCAcJ5Cp/m5qqJqgEM5Op6jHzwtzWV3syx+CBAgMBAAECgYEApSzqPzE3d3uqi+tpXB71oY5JcfB55PIjLPDrzFX7mlacP6JVKN7dVemVp9OvMTe/UE8LSXRVaFlkLsqXC07FJjhuwFXHPdnUf5sanLLdnzt3Mc8vMgUamGJl+er0wdzxM1kPTh0Tmq+DSlu5TlopAHd5IqF3DYiORIen3xIwp0ECQQDj6GFaXWzWAu5oUq6j1msTRV3mRZnx8Amxt1ssYM0+JLf6QYmpkGFqiQOhHkMgVUwRFqJC8A9EVR1eqabcBXbpAkEA3DQfLVr94vsIWL6+VrFcPJW9Xk28CNY6Xnvkin815o2Q0JUHIIIod1eVKCiYDUzZAYAsW0gefJ49sJ4YiRJN2QJAKuxeQX2s/NWKfz1rRNIiUnvTBoZ/SvCxcrYcxsvoe9bAi7KCMdxObJknhNXFQLav39wKbV73ESCSqnx7P58L2QJABmhR2+0A5EDvvj1WpokkqPKmfv7+ELfDHQq33LvU4q+N3jPn8C85ZDedNHzx57kru1pyb/mKQZANNX10M1DgCQJBAMKn0lExQH2GrkjeWgGVpPZkp0YC+ztNjaUMJmY5g0INUlDgqTWFNftxe8ROvt7JtUvlgtKCXdXQrKaEnpebeUQ=-----END PRIVATE KEY----------BEGIN PUBLIC KEY-----MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDEChqe80lJLTTkJD3X3Lyd7Fj+zuOhDZkjuLNPog3YR20e5JcrdqI9IFzNbACY/GQVhbnbvBqYgyql8DfPCGXpn0+XNSxELIUw9Vh32QuhGNr3/TBpechrVeVpFPLwyaYNEk1CawgHCeQqf5uaqiaoBDOTqeox88Lc1ld7MsfggQIDAQAB-----END PUBLIC KEY-----Then you send the public key to iOS appSo, your Objective-C gets only this data(no other bullshit!):-----BEGIN PUBLIC KEY-----MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDEChqe80lJLTTkJD3X3Lyd7Fj+zuOhDZkjuLNPog3YR20e5JcrdqI9IFzNbACY/GQVhbnbvBqYgyql8DfPCGXpn0+XNSxELIUw9Vh32QuhGNr3/TBpechrVeVpFPLwyaYNEk1CawgHCeQqf5uaqiaoBDOTqe
© 2010 - 2020 网站综合信息查询 同IP网站查询 相关类似网站查询 网站备案查询网站地图 最新查询 最近更新 优秀网站 热门网站 全部网站 同IP查询 备案查询
2024-10-20 00:17, Process in 0.0060 second.