Adds main cert & fixes some typos
这个提交包含在:
父节点
02f0a741b5
当前提交
94f3060419
共有 5 个文件被更改,包括 39 次插入 和 10 次删除
|
|
@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE;
|
|||
| be upgraded / downgraded to.
|
||||
|
|
||||
*/
|
||||
$config['migration_version'] = 44;
|
||||
$config['migration_version'] = 45;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -103,14 +103,14 @@ class Lotw extends CI_Controller {
|
|||
// New Certificate Store in Database
|
||||
|
||||
// Store Certificate Data into MySQL
|
||||
$this->LotwCert->store_certficiate($this->session->userdata('user_id'), $info['issued_callsign'], $dxcc, $info['validFrom'], $info['validTo_Date'], $info['pem_key']);
|
||||
$this->LotwCert->store_certficiate($this->session->userdata('user_id'), $info['issued_callsign'], $dxcc, $info['validFrom'], $info['validTo_Date'], $info['pem_key'], $info['general_cert']);
|
||||
|
||||
// Cert success flash message
|
||||
$this->session->set_flashdata('Success', $info['issued_callsign'].' Certficiate Imported.');
|
||||
} else {
|
||||
// Certficiate is in the system time to update
|
||||
|
||||
$this->LotwCert->update_certficiate($this->session->userdata('user_id'), $info['issued_callsign'], $dxcc, $info['validFrom'], $info['validTo_Date'], $info['pem_key']);
|
||||
$this->LotwCert->update_certficiate($this->session->userdata('user_id'), $info['issued_callsign'], $dxcc, $info['validFrom'], $info['validTo_Date'], $info['pem_key'], $info['general_cert']);
|
||||
|
||||
// Cert success flash message
|
||||
$this->session->set_flashdata('Success', $info['issued_callsign'].' Certficiate Updated.');
|
||||
|
|
@ -237,11 +237,16 @@ class Lotw extends CI_Controller {
|
|||
$password = $password; // Only needed if 12 has a password set
|
||||
$filename = file_get_contents('file://'.$file);
|
||||
$worked = openssl_pkcs12_read($filename, $results, $password);
|
||||
|
||||
$data['general_cert'] = $results['cert'];
|
||||
|
||||
|
||||
if($worked) {
|
||||
// Reading p12 successful
|
||||
$new_password = "cloudlog"; // set default password
|
||||
$result = null;
|
||||
$worked = openssl_pkey_export($results['pkey'], $result, $new_password);
|
||||
|
||||
if($worked) {
|
||||
// Store PEM Key in Array
|
||||
$data['pem_key'] = $result;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Migration_add_cert_to_lotw_certs extends CI_Migration {
|
||||
|
||||
public function up()
|
||||
{
|
||||
$fields = array(
|
||||
'cert TEXT',
|
||||
);
|
||||
|
||||
|
||||
$this->dbforge->add_column('lotw_certs', $fields);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->dbforge->drop_column('lotw_certs', 'cert');
|
||||
}
|
||||
}
|
||||
|
|
@ -40,7 +40,7 @@ class LotwCert extends CI_Model {
|
|||
return $query->num_rows();
|
||||
}
|
||||
|
||||
function store_certficiate($user_id, $callsign, $dxcc, $date_created, $date_expires, $cert_key) {
|
||||
function store_certficiate($user_id, $callsign, $dxcc, $date_created, $date_expires, $cert_key, $general_cert) {
|
||||
$data = array(
|
||||
'user_id' => $user_id,
|
||||
'callsign' => $callsign,
|
||||
|
|
@ -48,17 +48,19 @@ class LotwCert extends CI_Model {
|
|||
'date_created' => $date_created,
|
||||
'date_expires' => $date_expires,
|
||||
'cert_key' => $cert_key,
|
||||
'cert' => $general_cert,
|
||||
);
|
||||
|
||||
$this->db->insert('lotw_certs', $data);
|
||||
}
|
||||
|
||||
function update_certficiate($user_id, $callsign, $dxcc, $date_created, $date_expires, $cert_key) {
|
||||
function update_certficiate($user_id, $callsign, $dxcc, $date_created, $date_expires, $cert_key, $general_cert) {
|
||||
$data = array(
|
||||
'cert_dxcc' => $dxcc,
|
||||
'date_created' => $date_created,
|
||||
'date_expires' => $date_expires,
|
||||
'cert_key' => $cert_key,
|
||||
'cert' => $general_cert
|
||||
);
|
||||
|
||||
$this->db->where('user_id', $user_id);
|
||||
|
|
|
|||
|
|
@ -2,14 +2,15 @@
|
|||
header('Content-Type: text/plain; charset=utf-8');
|
||||
?>
|
||||
<?php
|
||||
$cert1 = str_replace("-----BEGIN ENCRYPTED PRIVATE KEY-----", "", $lotw_cert_info->cert_key);
|
||||
$cert2 = str_replace("-----END ENCRYPTED PRIVATE KEY-----", "", $cert1);
|
||||
$clean_cert = trim($lotw_cert_info->cert);
|
||||
$cert1 = str_replace("-----BEGIN CERTIFICATE-----", "", $clean_cert);
|
||||
$cert2 = str_replace("-----END CERTIFICATE-----", "", $cert1);
|
||||
?>
|
||||
<TQSL_IDENT:53>TQSL V2.5.1 Lib: V2.5 Config: V11.9 AllowDupes: false
|
||||
<TQSL_IDENT:54>TQSL V2.5.4 Lib: V2.5 Config: V11.12 AllowDupes: false
|
||||
|
||||
<Rec_Type:5>tCERT
|
||||
<CERT_UID:1>1
|
||||
<CERTIFICATE:<?php echo strlen(trim($cert2)); ?>><?php echo trim($cert2); ?>
|
||||
<CERTIFICATE:<?php echo strlen(trim($cert2)) + 1; ?>><?php echo trim($cert2); ?>
|
||||
|
||||
<eor>
|
||||
|
||||
|
|
@ -121,7 +122,7 @@ if($qso->COL_SAT_NAME) {
|
|||
$signed_item = $CI->signlog($lotw_cert_info->cert_key, $sign_string);
|
||||
|
||||
?>
|
||||
<SIGN_LOTW_V2.0:<?php echo strlen($signed_item); ?>:6><?php echo $signed_item; ?>
|
||||
<SIGN_LOTW_V2.0:<?php echo strlen($signed_item)+1; ?>:6><?php echo $signed_item; ?>
|
||||
|
||||
<SIGNDATA:<?php echo strlen($sign_string); ?>><?php echo $sign_string; ?>
|
||||
|
||||
|
|
|
|||
正在加载…
在新工单中引用