[pve-devel] [PATCH common v2] JSONSchema: add fingerprint-sha256 standard option

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Jan 8 09:38:52 CET 2018


Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---

changes v1 -> v2:
* remove anchors, their already applied on parsing
* do not allow double colon separation,
  Net::SSLeay::X509_get_fingerprint only emits single colon separated
* allow case insensitive hex values, users of the format must handle
  the comparison, e.g., by uppercasing a param (uc()). Do not use
  quoted regex qr/.../i here as the typetext for the documentation
  gets a bit hard to read with it, i.e. compare:
  ([A-Fa-f0-9]{2}:){31}[A-Fa-f0-9]{2} vs (?^i:([A-F0-9]:){31}[A-F0-9])
  the ?^i (reset flags and then enable case-insensitive mode) is less
  intuitive, IMO.

 src/PVE/JSONSchema.pm | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/PVE/JSONSchema.pm b/src/PVE/JSONSchema.pm
index 9c26184..c09a9f4 100644
--- a/src/PVE/JSONSchema.pm
+++ b/src/PVE/JSONSchema.pm
@@ -99,6 +99,12 @@ register_standard_option('extra-args', {
     optional => 1
 });
 
+register_standard_option('fingerprint-sha256', {
+    description => "Certificate SHA 256 fingerprint.",
+    type => 'string',
+    pattern => '([A-Fa-f0-9]{2}:){31}[A-Fa-f0-9]{2}',
+});
+
 my $format_list = {};
 
 sub register_format {
-- 
2.11.0





More information about the pve-devel mailing list