|
@@ -12,6 +12,7 @@ using System.Drawing.Imaging;
|
|
|
using System.IO;
|
|
|
using System.Reflection;
|
|
|
using System.Runtime.Remoting.Messaging;
|
|
|
+using System.Text;
|
|
|
using System.Windows;
|
|
|
using System.Windows.Controls;
|
|
|
using System.Windows.Controls.Primitives;
|
|
@@ -50,7 +51,7 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
private string location = string.Empty;
|
|
|
|
|
|
private string reason = string.Empty;
|
|
|
-
|
|
|
+
|
|
|
private float[] textColor = new float[] { 0, 0, 0 };
|
|
|
|
|
|
private string _signaturePath = string.Empty;
|
|
@@ -366,7 +367,35 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
{
|
|
|
Text += "DN: ";
|
|
|
}
|
|
|
- Text += signatureCertificate.Subject + "\n";
|
|
|
+ var keyOrder = new List<string> { "CN", "O", "OU", "L", "ST", "emailAddress", "C" };
|
|
|
+
|
|
|
+ var keyMapping = new Dictionary<string, string>
|
|
|
+ {
|
|
|
+ { "CN", "cn" },
|
|
|
+ { "OU", "ou" },
|
|
|
+ { "O", "o" },
|
|
|
+ { "L", "l" },
|
|
|
+ { "ST", "st" },
|
|
|
+ { "C", "c" },
|
|
|
+ { "emailAddress", "email" }
|
|
|
+ };
|
|
|
+
|
|
|
+ var stringBuilder = new StringBuilder();
|
|
|
+
|
|
|
+ foreach (var originalKey in keyOrder)
|
|
|
+ {
|
|
|
+ if (keyMapping.TryGetValue(originalKey, out string newKey) &&
|
|
|
+ signatureCertificate.SubjectDict.TryGetValue(originalKey, out string value) && !string.IsNullOrEmpty(value))
|
|
|
+ {
|
|
|
+ if (stringBuilder.Length > 0)
|
|
|
+ {
|
|
|
+ stringBuilder.Append(",");
|
|
|
+ }
|
|
|
+ stringBuilder.Append(newKey + "=" + value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Text += stringBuilder.ToString();
|
|
|
}
|
|
|
|
|
|
if ((bool)ComPDFKitVersionChk.IsChecked)
|
|
@@ -600,7 +629,7 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
float red = solidColorBrush.Color.R;
|
|
|
float green = solidColorBrush.Color.G;
|
|
|
float blue = solidColorBrush.Color.B;
|
|
|
- textColor = new [] { red / 255, green / 255, blue / 255};
|
|
|
+ textColor = new[] { red / 255, green / 255, blue / 255 };
|
|
|
|
|
|
KeyboardPopup.Visibility = Visibility.Collapsed;
|
|
|
SetProperty();
|