Subversion Repositories php-qbpwcf

Rev

Rev 5 | Rev 222 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5 liveuser 1
#!/bin/php
2
<?php
3
 
4
/*
5
 
6
        QBPWCF, Quick Build PHP website Component base on Fedora Linux.
7
    Copyright (C) 2014~2025 Min-Jhin,Chen
8
 
9
    This file is part of QBPWCF.
10
 
11
    QBPWCF is free software: you can redistribute it and/or modify
12
    it under the terms of the GNU General Public License as published by
13
    the Free Software Foundation, either version 3 of the License, or
14
    (at your option) any later version.
15
 
16
    QBPWCF is distributed in the hope that it will be useful,
17
    but WITHOUT ANY WARRANTY; without even the implied warranty of
18
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
    GNU General Public License for more details.
20
 
21
    You should have received a copy of the GNU General Public License
22
    along with QBPWCF.  If not, see <http://www.gnu.org/licenses/>.
23
 
24
*/
25
 
26
#使用命名空間qbpwcf
27
namespace qbpwcf;
28
 
29
#assets dir
30
$assetsDir="assets of zerossl::createPrivateKey_20241129";
31
 
32
#函式說明:
33
#產生ssl private key.
34
#回傳結果:
35
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
36
#$reuslt["error"],執行不正常結束的錯訊息陣列.
37
#$result["function"],當前執行的函式名稱.
38
#$result["argu"],所使用的參數.
39
#$result["curl_verbose_info"],curl執行的詳細資訊.
40
#必填參數:
41
#$conf["fileArgu"],字串,變數__FILE__的內容.
42
$conf["fileArgu"]=__FILE__;
43
#可省略參數:
44
#$conf["length"],整數,金鑰的長度,預設為 4096(bit).
45
#$conf["length"]=4096';
46
#參考資料:
47
#無.
48
#備註:
49
#key generated by openssl with RSA.
50
$createPrivateKey=zerossl::createPrivateKey($conf);
51
unset($conf);
52
 
53
#如果執行失敗
54
if($createPrivateKey["status"]==="false"){
55
 
56
	#函式說明:
57
	#撰寫log
58
	#回傳結果:
59
	#$result["status"],狀態,"true"或"false".
60
	#$result["error"],錯誤訊息陣列.
61
	#$result["function"],當前函式的名稱.
62
	#$result["argu"],使用的參數.
63
	#必填參數:
64
	#$conf["path"],字串,log檔案的路徑與名稱.
65
	$conf["path"]=$logFile;
66
	#$conf["content"],any,要寫的內容,若內容不為字串則會用var_dump的格式寫入.
67
	$conf["content"]=$createPrivateKey;
68
	#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
69
	$conf["fileArgu"]=__FILE__;
70
	#可省略參數:
71
	#$conf["rewrite"],預設為"false",接續寫入;反之"true"代表重新寫入.
72
	#$conf["rewrite"]="false";
73
	#參考資料:
74
	#無.
75
	#備註:
76
	#無.
77
	$record=logs::record($conf);
78
	unset($conf);
79
 
80
	#如果寫log失敗
81
	if($record["status"]==="false"){
82
 
83
		#印出結果
84
		var_dump($record);
85
 
86
		}#if end
87
 
88
	#結束執行,回傳錯誤代碼1
89
	exit(1);
90
 
91
	}#if end
92
 
93
#debug
94
var_dump($createPrivateKey);