OpenSSL

OPENSSL Blowfish CBC encryption differs from PHP to C++

喜欢而已 提交于 2021-01-28 09:15:46
问题 I am trying to encrypt and decrypt a communication between a C++ library and a PHP server using OPENSSL library in both of them. I want to use the Blowfish CBC algorithm but it seems that the results are different between the C++ code and the PHP code. The C++ code is taken from here: This is the PHP code: <?php function strtohex($x) { $s=''; foreach (str_split($x) as $c) $s.=sprintf("%02X",ord($c)); return($s); } $encryptedMessage = openssl_encrypt("input", "BF-CBC", "123456", 0, "initvect")

OPENSSL Blowfish CBC encryption differs from PHP to C++

荒凉一梦 提交于 2021-01-28 09:11:46
问题 I am trying to encrypt and decrypt a communication between a C++ library and a PHP server using OPENSSL library in both of them. I want to use the Blowfish CBC algorithm but it seems that the results are different between the C++ code and the PHP code. The C++ code is taken from here: This is the PHP code: <?php function strtohex($x) { $s=''; foreach (str_split($x) as $c) $s.=sprintf("%02X",ord($c)); return($s); } $encryptedMessage = openssl_encrypt("input", "BF-CBC", "123456", 0, "initvect")

Create Self Signed Certificate with Subject Key Identifier

大城市里の小女人 提交于 2021-01-28 07:43:19
问题 I want to create a self signed certificate with RSA algorithm keysize 2048 with subject key identifier. I know we made some some default change in openssl.conf . What i suppose to change? genrsa -des3 -out mcedt.key 2048 req -new -key mcedt.key -out mcedt.csr CN = server.test , OU =, O =, L = Toronto, S = ontario , C = can x509 -req -days 365 -in mcedt.csr -signkey mcedt.key -out mcedt.crt pkcs12 -export -in mcedt.crt -inkey mcedt.key -out mcedt.pfx 回答1: You could create an extension file

Digitally sign a hex string in command line using elliptic curve secp256k1

房东的猫 提交于 2021-01-28 06:51:40
问题 I'm trying to figure out the most simple way to digitally sign a string of hex values using a private key also represented by a string of hex values. I'm open to command line, or a script, but preferably using openssl cli. Example: string to sign: 1333183ddf384da83ed49296136c70d206ad2b19331bf25d390e69b222165e37 private key: a675c86089e0622c112379906f5cf19ee336575af1bfa1de558051312db9afdc Hoping there is a command like: $ openssl sign -msg

QWebView, how to access https protocol WebPage?

a 夏天 提交于 2021-01-28 05:49:00
问题 My platform: win32, QtSDK 2.4.1, MingW32, qt 4.7. I want to access Https protocol webpage by QWebView , how can i do that, i had download the openssl binary, and setup it, but QWebView doesn't work also, what is wrong? i needed to compile Qt source code and configure -openssl? #include<QApplication> #include<QtWebKit/QWebView> #include<QUrl> int main(int argc, char* argv[]) { QApplication app(argc, argv); QWebView view; view.setUrl(QUrl("https://webim.feixin.10086.cn/")); view.show(); return

starttls successful even after deleting CA from the ca dir

北慕城南 提交于 2021-01-27 22:51:12
问题 I'm having trouble verifying the correct behavior of my software. Here are the steps I am performing to verify correct operation: I have sample code that uses openldap library and doing a start tls to a ldap server. I have set the global option for ca cert directory and tlx context for the first time. After that I did ldap int and ldap start tls to a server. This is succesful as expected. I did an ldap_unbind_s I deleted the CA cert that signed the ldap server's certificate from the ca cert

Is there any way to generate PSS padded signatures in PHP?

元气小坏坏 提交于 2021-01-27 20:40:43
问题 In PHP, I want to sign some documents with a padding of PSS, and a digest of SHA512. According to the docs, at http://www.php.net/manual/en/function.openssl-sign.php, I can set the digest however I need, by using a string, such as openssl_sign($text-to-sign,$binary_signature,$privkey,"sha512"); I don't see any way to set the padding, however. Can anyone please help me understand how I can sign text, using the RSA-PSS padding style, as seen in version 2.1 of PKCS #1? 回答1: In order not to be

Monte Carlo Test on AES 128 CBC

点点圈 提交于 2021-01-27 18:54:14
问题 I'm performing MCT on AES 128 CBC as described in http://csrc.nist.gov/groups/STM/cavp/documents/aes/AESAVS.pdf The expected vector result for first iteration is KEY = 9dc2c84a37850c11699818605f47958c IV = 256953b2feab2a04ae0180d8335bbed6 PLAINTEXT = 2e586692e647f5028ec6fa47a55a2aab CIPHERTEXT = 1b1ebd1fc45ec43037fd4844241a437f Below function is used to generate first iteration output, void do_mct() { EVP_CIPHER_CTX *ctx = NULL; unsigned char key[16] = { 0x9d, 0xc2, 0xc8, 0x4a, 0x37, 0x85,

Mapping RFC names to OpenSSL

风流意气都作罢 提交于 2021-01-27 16:41:32
问题 Passing string didn't work I want to get a cipher using EVP_get_cipherbyname , I have the following RFC name: TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 which should map to this OpenSSL name: DHE-RSA-AES128-GCM-SHA256 . But when passing this string to the function, it can't find the cipher. Passing integer didn't work Using openssl -V I can see this is a supported cipher, and that it has a value 0x9e which is 158 in base 10, I have assumed that this would be the NID, and tried calling EVP_get

Mapping RFC names to OpenSSL

余生长醉 提交于 2021-01-27 16:36:56
问题 Passing string didn't work I want to get a cipher using EVP_get_cipherbyname , I have the following RFC name: TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 which should map to this OpenSSL name: DHE-RSA-AES128-GCM-SHA256 . But when passing this string to the function, it can't find the cipher. Passing integer didn't work Using openssl -V I can see this is a supported cipher, and that it has a value 0x9e which is 158 in base 10, I have assumed that this would be the NID, and tried calling EVP_get