**好的,很明显,这个问题与Linux服务器上openssl的设置以及如何正确设置自定义openssl.cnf文件有关.我不是在寻找任何复杂的东西,但我需要一个前端能够创建自签名客户端证书,以便对我的webservice进行身份验证.因此,我需要能够使用我的CA为客户公司创建中间CA,然后允许他们使用安全接口为其员工颁发客户端证书.登录基于您是否属于特定的中间CA,以及您的证书或中间CA是否未被撤销.
对于任何想知道的人,我们可以使用自签名证书,因为它们仅用于我们的服务器来验证用户,因为我们发布它们,我们相信它们.对于初创公司而言,通过商业产品AFAIK建立自己作为中间CA的方式也太昂贵了.微软可以做到这一点,我们做不到.我们的网络服务器本身使用CA签名证书.
我知道用于设置此类事物的PHP代码是直截了当的,但不是如何正确设置openssl.我在网上尝试了几个不同的例子,它们似乎都不适用于我的设置,它们似乎都有所不同.一个盒子是全新安装的Centos 6.2,我仍然遇到错误.
任何人都可以指出我正确的方向设置openssl,apache2和php,以便我可以使用这些PHP库没有错误?我们的虚拟服务器使用debian squeeze,我可以完全控制安装的软件.
谢谢.
open_pkey_new()返回错误,如错误:0E06D06C:配置文件例程:NCONF_get_string:无值.然而,我正在通过一个openssl.cnf文件的路径,所以我不知道为什么我仍然遇到这个问题.这是我的相关代码
<?php
$cwd=getcwd();
$distname= array(
"countryName" => "CA",
"stateOrProvinceName" => "Ontario",
"localityName" => "Toronto",
"organizationName" => "G4 Apps",
"organizationalUnitName" => "Development",
"commonName" => "Mark Lane",
"emailAddress" => "nobody at gmail.com"
);
$password = 'seanix';
$cacert_location=$cwd."/certs/CA/g4CA.crt";
$cakey_location=$cwd."/certs/CA/g4CA.key";
$cnf=$cwd.'/certs/myopenssl.cnf';
$configArgs = array(
'config' =>$cnf
);
?>
Run Code Online (Sandbox Code Playgroud)
这是我制作钥匙的功能.
<?php
function makekey($password,$configArgs) {
$key= openssl_pkey_new($configArgs);
//print_r($configArgs);
openssl_pkey_export($key, $pkeyout,$password);
if (($e=openssl_error_string()) ==false) return $pkeyout;
else {
do {
echo $e . "<BR>";
} while($e=openssl_error_string());
return -1;
} …Run Code Online (Sandbox Code Playgroud) 我有一个简单的jquery ajax脚本,它将值发送到Web服务进行处理但由于某种原因,jquery根本不运行.
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
<script type="text/javascript" src="jquery-1.8.2.js"></script>
<script type="text/javascript" src="update-cart.js"></script>
</head>
<body>
<div id='colors'>
<a href="3333">Add Color</a>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
这是jQuery
// to use surround anchor tags with div (id=colors). Set color or scheme id as href value. On click the item is posted to the web service.
// To do improve response handling from webservice.
$(document)ready(function(){
$("#colors a").live("click", function() {
alert("We get here");
var item = $(this).attr( 'href' );
var jqxhr = …Run Code Online (Sandbox Code Playgroud) 这与类中的对象数组有关.我最初将它添加到该问题,但因为这个问题得到了回答,我没有收到回复.
所以我有2节课.一个包含另一个类的列表.我正在将数据添加到我从数据库中取出的类中.但是,当我从List中取出数据时,值都是相同的.它们是列表中最后一个元素的值.
我已经尝试在每个循环中重新创建对象,但它似乎仍然导致问题.我不知道我在这里做错了什么.
public class xmldata {
String Barcode;
String First;
String Last;
String Phone;
String Email;
String md5sum;
String zipfile;
List<PictureData> pics = new ArrayList<PictureData>();
Run Code Online (Sandbox Code Playgroud)
...
public class PictureData {
static String filename;
static String directory;
Run Code Online (Sandbox Code Playgroud)
...
xmldata data = new xmldata();
ResultSet pictures=db.query("select * from pictures where barcode=?",barcode);
while (pictures.next()) {
PictureData pictemp= new PictureData();
pictemp.setdirectory(pictures.getString("path"));
pictemp.setfilename(pictures.getString("filename"));
data.pics.add(pictemp);
}
Run Code Online (Sandbox Code Playgroud)
...
for (int j=0; j<data.pics.size();++j) {
String path;
PictureData pictemp2= new PictureData();
pictemp2=(PictureData) data.pics.get(j);
path=pictemp2.getdirectory()+pictemp2.getfilename();
System.out.println(path);
zip.addfile(path); …Run Code Online (Sandbox Code Playgroud) 当我试图阻止正在运行的线程时,我似乎无法弄清楚为什么我会得到一个空指针异常.ftprun.requestStop()设置while循环的值,以便应用程序停止.
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
JButton btn = (JButton) e.getSource();
Thread ftpthread= null;
LocalFTP ftprun = null;
switch (e.getActionCommand()) {
case "Start Sorter":
if(ftp) {
JOptionPane.showMessageDialog(frame, "Sorter and ftp cannot run at the same time");
} else {
sorter=true;
btn.setText("Stop Sorter");
btn.setBackground(SystemColor.green);
}
break;
case "Start ftp":
if(sorter) {
JOptionPane.showMessageDialog(frame, "Sorter and ftp cannot run at the same time");
} else {
ftp=true;
btn.setText("Stop ftp");
btn.setBackground(SystemColor.green);
Config config = new Config();
try …Run Code Online (Sandbox Code Playgroud)