切换非root用户
su www
进入 项目目录
PHP composer.phar require "robrichards/xmlseclibs"
github地址:https://github.com/robrichards/xmlseclibs
下面的示例显示了xmlseclibs的基本用法,带有SHA-256签名
use RobRichards\XMLSeclibs\XMLSecurityDSig;use RobRichards\XMLSeclibs\XMLSecurityKey;// Load the XML to be signed$doc = new DOMdocument();$doc->load('./path/to/file/tobesigned.xml');// Create a new Security object $objDSig = new XMLSecurityDSig();// Use the c14n exclusive canonicalization$objDSig->setCanonicalMethod(XMLSecurityDSig::EXC_C14N);// Sign using SHA-256$objDSig->addReference( $doc, XMLSecurityDSig::SHA256, array('http://www.w3.org/2000/09/xmldsig#enveloped-signature'));// Create a new (private) Security key$objKey = new XMLSecurityKey(XMLSecurityKey::RSA_SHA256, array('type'=>'private'));/*If key has a passphrase, set it using$objKey->passphrase = '<passphrase>';*/// Load the private key$objKey->loadKey('./path/to/privatekey.pem', TRUE);// Sign the XML file$objDSig->sign($objKey);// Add the associated public key to the signature$objDSig->add509Cert(file_get_contents('./path/to/file/mycert.pem'));// Append the signature to the XML$objDSig->appendSignature($doc->documentElement);// Save the signed XML$doc->save('./path/to/signed.xml');
总结 以上是内存溢出为你收集整理的php composer安装扩展 xmlseclibs全部内容,希望文章能够帮你解决php composer安装扩展 xmlseclibs所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)