Merge pull request #357 from phl0/lotwFixing

[WIP] OpenSSL signatures need a newline after base64 string
This commit is contained in:
Florian (DF2ET)
2024-05-13 09:28:30 +02:00
committed by GitHub

View File

@@ -304,23 +304,13 @@ class Lotw extends CI_Controller {
//Tell cURL to return the output as a string.
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
//If the function curl_file_create exists
if(function_exists('curl_file_create')){
//Use the recommended way, creating a CURLFile object.
$filePath = curl_file_create($filePath);
} else{
//Otherwise, do it the old way.
//Get the canonicalized pathname of our file and prepend
//the @ character.
$filePath = '@' . realpath($filePath);
//Turn off SAFE UPLOAD so that it accepts files
//starting with an @
curl_setopt($ch, CURLOPT_SAFE_UPLOAD, false);
}
//Use the recommended way, creating a CURLFile object.
$uploadfile = curl_file_create($filePath);
$uploadfile->setPostFilename(basename($filePath));
//Setup our POST fields
$postFields = array(
$uploadFieldName => $filePath
$uploadFieldName => $uploadfile
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
@@ -976,7 +966,7 @@ class Lotw extends CI_Controller {
openssl_free_key($pkeyid);
}
$signature_b64 = base64_encode($signature);
return $signature_b64;
return $signature_b64."\n";
}
} else {
log_message('error', 'Error signing LoTW log.');