显示下拉菜单

openssl_private_decrypt()

« openssl_pkey_new | openssl_private_encrypt »
<?php
// enter a string to encrypt ($e_data),
// or a string encrypted in base64 ($base64) or binary ($data)
$e_bool openssl_public_encrypt(
    
// string $e_data,
    
$crypted,
    
// mixed $e_key
    
? // [int $e_padding]);
}

$base64 base64_encode($crypted);

$data base64_decode(
    
  // string $base64
);

$bool openssl_private_decrypt (
    
// string $data
    
// string &$decrypted
    
// mixed $key
    
?  // [int $padding = OPENSSL_PKCS1_PADDING]
);

// shows the data in base64
if ($e_bool) {
    
$base64 base64_encode($crypted);
}
?>
结果
$e_bool = true
$data = 'iO<=\\0[tV\\Gh:EgDi}1~J    9x$F    論,C+{}5<Z8:x!;"=X|Ե@ ,[lX JI?]}!I@LuHհ܁0P>`_7 u+O+?w}es{|!z䐭s4' "\0" 'Ia9:B~,b#    5&U#䃌="0~&A'
$base64 = 'D2nUGk/um5ce0Dw9XDCLW3QWVoD0XEdoyBA6ikVn/ES11+EDaX22yhvyMYnhfqSv4ZP/wxOX5koJEI052HgklEakCe+lgegs2EMrn/F73H2QNcveHh/C6DzuWji6OpB4ECG+oDupvIgiPbiXWBC9fNS1QIj5FtoL3yysz1tspVjfDUq0SY/g1j9dfZwF6pHAHPGFASHWSUBMH7uMvO8VhnX6SNWw3IEwUD5g0F83C3Ur2dpPmivQ7/A/wHd9ZXPle6iM9dl8IeoZgHqF1uSQrX9ziDQASZ1hBIU5OkKzjZGs7I9+DyxilRinI/UJqzUmBeZVI+SDjD0iMH6YqJkmQQ=='
$decrypted = 'this is some data'
$bool = true
示例
#1 openssl_private_decrypt  ("\xb8\x9a\x8c\x26\x19\x0a\x24\xc1\xf3\x7a\x9d\x74\xe3\x28\xff\xf7\x99\x98\x1d\xd1\xef\xbc\x8e\x35\x56\xd5\x41\xe4\x07\xf6\xa9\xb7\xc5\x67\xbe\x9c\xc1\x91\x61\xbe\x66\x19\x11\x6d\x41\xba\x12\xde\x02\x81\x13\x54\x37\xee\x6b\x4c\x2a\xe1\x6e\x81\x02\x35\x41\xdc\xea\x81\x7f\xcb\xe4\x48\xe8\x59\x6f\x67\xd4\x98\xc0\x47\x6f\x6c\x3c\x13\xf8\x59\x49\x73\x46\x79\xd2\x45\x5f\x13\x36\x59\x1b\x97\xfd\xb4\x16\xa3\xa4\x31\xee\x0f\x2c\xbb\x30\x95\x07\xa1\xfe\x8e\xe8\x1d\xd2\xd7\xce\x22\x7f\xbe\x9d\xd9\x6c\x42\x55\x94\xf8\x51\x14\x1d\xf7\xf5\x29\x27\xe6\x85\xae\x46\xe9\xfa\x93\xf8\xf0\x04\xd0\x6c\x9b\x5f\x1c\x82\x8a\xa7\x7a\xc3\xa9\x16\x51\xd0\xf4\x70\x17\xd6\x56\xec\x3b\xf6\xff\x28\xf0\x3a\x17\xe4\xb6\xc7\xa0\xa8\x75\x0d\x71\x2d\x30\xfd\xdd\x5b\xfd\xd7\x49\x2c\xa0\x50\x95\x02\xce\x68\xec\x09\xc7\xd6\x40\x9b\xb2\x42\xa0\xe4\xdd\x60\x10\x65\x60\xba\xe1\x56\xae\xed\xe1\xa8\xf2\x46\x5a\x54\x9b\x0e\xfa\xb4\xe9\x6f\xaa\x8e\xce\xff\x88\xca\x33\xd6\x4c\x39\xfb\x8e\xfc\x33\x44\x0b\x79\x98\x8f\x19\x4a\x34\x80\xd5\x11\x4a\x78\x92\x18\x8b",
 
$decrypted,
 
"file:///tmp/private-key.pem")
#2 openssl_private_decrypt  (/* $base64 = "uJqMJhkKJMHzep104yj/95mYHdHvvI41VtVB5Af2qbfFZ76cwZFhvmYZEW1BuhLeAoETVDfua0wq4W6BAjVB3OqBf8vkSOhZb2fUmMBHb2w8E/hZSXNGedJFXxM2WRuX/bQWo6Qx7g8suzCVB6H+jugd0tfOIn++ndlsQlWU+FEUHff1KSfmha5G6fqT+PAE0GybXxyCiqd6w6kWUdD0cBfWVuw79v8o8DoX5LbHoKh1DXEtMP3dW/3XSSygUJUCzmjsCcfWQJuyQqDk3WAQZWC64Vau7eGo8kZaVJsO+rTpb6qOzv+IyjPWTDn7jvwzRAt5mI8ZSjSA1RFKeJIYiw==" */
 
$data,
 
$decrypted,
 
"file:///tmp/private-key.pem")
#3 openssl_private_decrypt  (/* $e_data = "this is some data" */
 /* $e_key = "file:///tmp/public-key.pem" */
 /* $base64 = $base64 */
 
$data,
 
$decrypted,
 
"file:///tmp/private-key.pem")
#4 openssl_private_decrypt  (/* $e_data = "this is some data" */
 /* $e_key = "-----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0llCeBjy18RylTdBih9G MUSZIC3GzeN0vQ9W8E3nwy2jdeUnH3GBXWpMo3F43V68zM2Qz5epRNmlLSkY/PJU fJIC8Yc1VEokT52q87hH/XJ5eS8heZnjuSlPAGi8oZ3ImVbruzV7XmlD+QsCSxJW 7tBv0dqJ71e1gAAisCXK2m7iyf/ul6rT0Zz0ptYH4IZfwc/hQ9JcMg69uM+3bb4o BFsixMmEQwxKZsXk3YmO/YRjRbay+6+79bSV/frW+lWhknyGSIJp2CJArYcOdbK1 bXx1dRWpbNSExo7dWwuPC0Y7a5AEeoZofieQPPBhXlp1hPgLYGat71pDqBjKLvF5 GwIDAQAB -----END PUBLIC KEY-----" */
 
$data,
 
$decrypted,
 
"-----BEGIN RSA PRIVATE KEY----- MIIEogIBAAKCAQEA0llCeBjy18RylTdBih9GMUSZIC3GzeN0vQ9W8E3nwy2jdeUn H3GBXWpMo3F43V68zM2Qz5epRNmlLSkY/PJUfJIC8Yc1VEokT52q87hH/XJ5eS8h eZnjuSlPAGi8oZ3ImVbruzV7XmlD+QsCSxJW7tBv0dqJ71e1gAAisCXK2m7iyf/u l6rT0Zz0ptYH4IZfwc/hQ9JcMg69uM+3bb4oBFsixMmEQwxKZsXk3YmO/YRjRbay +6+79bSV/frW+lWhknyGSIJp2CJArYcOdbK1bXx1dRWpbNSExo7dWwuPC0Y7a5AE eoZofieQPPBhXlp1hPgLYGat71pDqBjKL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K47ZcI7jGL4V4C8ujU8YcMNV88xwCoDg9ZIFprWA P5p/cnvj6aHnqL58XiH0+bE0Lt3J+U6N6JelQQevgBHooMFh4FpDXcVda7xB3rK3 woqbi8fNhr827H2maxIZPtVG95/mvR4k5z1Jrdnr34ZUmtC6U5Q= -----END RSA PRIVATE KEY-----")
另请参阅
base64_decode, base64_encode, openssl_public_decrypt, openssl_public_encrypt