note 126047 added to function.openssl-cms-sign

From: Date: Sat, 01 May 2021 11:30:16 +0000
Subject: note 126047 added to function.openssl-cms-sign
Groups: php.notes 
Request: Send a blank email to php-notes+get-216335@lists.php.net to get a copy of this message
Manage to make it work at last. $dn = array( "countryName" => "XX", "stateOrProvinceName" => "Location", "localityName" => "Local", "organizationName" => "Sample Organization", "organizationalUnitName" => "Organizational Unit", "commonName" => "Sample", "emailAddress" => "contactus@email.com" ); // Generate a new private (and public) key pair $privkey = openssl_pkey_new(array( "private_key_bits" => 4096, "private_key_type" => OPENSSL_KEYTYPE_RSA, )); // Generate a certificate signing request $csr = openssl_csr_new($dn, $privkey, array('digest_alg' => 'sha512')); // Generate a self-signed cert, valid for 365 days $x509 = openssl_csr_sign($csr, null, $privkey, $days=365, array('digest_alg' => 'sha512')); // Save your private key, CSR and self-signed cert for later use openssl_csr_export($csr, $csrout) and var_dump($csrout); // .csr openssl_x509_export($x509, $certout) and var_dump($certout); // .crt.pem openssl_pkey_export($privkey, $pkeyout, "user_defined_password") and var_dump($pkeyout); // .key.pem if(openssl_cms_sign ( "file_to_sign", "Sample.p7m" , $x509 , $privkey, null , 0 , 0 , null )){ echo "SIGNED SUCCESSFULLY! Sample.p7m created... \r\n"; } else { echo "SIGNED FAILED!\r\n"; } ---- Server IP: 45.112.84.4 Probable Submitter: 45.112.85.242 (proxied: 2001:8f8:1e3d:40ba:cf0:47d9:c66b:645f) ---- Manual Page -- https://php.net/manual/en/function.openssl-cms-sign.php Edit -- https://main.php.net/note/edit/126047 Del: integrated -- https://main.php.net/note/delete/126047/integrated Del: useless -- https://main.php.net/note/delete/126047/useless Del: bad code -- https://main.php.net/note/delete/126047/bad+code Del: spam -- https://main.php.net/note/delete/126047/spam Del: non-english -- https://main.php.net/note/delete/126047/non-english Del: in docs -- https://main.php.net/note/delete/126047/in+docs Del: other reasons-- https://main.php.net/note/delete/126047 Reject -- https://main.php.net/note/reject/126047 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#216335) next »