keys/tripe-keys.in, keys/tripe-keys.conf.5.in: Allow setting attributes.
authorMark Wooding <mdw@distorted.org.uk>
Mon, 17 Apr 2017 23:39:24 +0000 (00:39 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 14 May 2017 17:19:08 +0000 (18:19 +0100)
Add `master-attrs' and `kx-attrs' options to allow setting arbitrary
attributes on keys.

keys/tripe-keys.conf.5.in
keys/tripe-keys.in

index 06ba3e4..b6bc6eb 100644 (file)
@@ -117,6 +117,13 @@ default.  Usually set up automatically.
 Additional options for generating master keys.  Default is
 .RB ` -l '.
 .TP
+.I master-attrs
+Additional attributes to set on the master key,
+as
+.IB key = value
+pairs separated by spaces.
+Default is empty.
+.TP
 .I hk-master
 The fingerprint of the current master signing key.  No default.  Usually
 set up automatically.
@@ -201,6 +208,14 @@ ec \-Cnist-p256
 _
 .TE
 .TP
+.I kx-attrs
+Additional attributes to set on the parameters
+(and therefore copied to peer keys),
+as
+.IB key = value
+pairs separated by spaces.
+Default is empty.
+.TP
 .I kx-expire
 Expiry time for generated keys.  Default is
 .BR "now + 1 year" .
index ce9f74d..f40f396 100644 (file)
@@ -244,11 +244,13 @@ def conf_defaults():
                                             'ec': 'ec-param'}[conf['kx']]),
                ('kx-param', lambda: {'dh': '-LS -b3072 -B256',
                                      'ec': '-Cnist-p256'}[conf['kx']]),
+               ('kx-attrs', ''),
                ('kx-expire', 'now + 1 year'),
                ('kx-warn-days', '28'),
                ('cipher', 'rijndael-cbc'),
                ('hash', 'sha256'),
                ('master-keygen-flags', '-l'),
+               ('master-attrs', ''),
                ('mgf', '${hash}-mgf'),
                ('mac', lambda: '%s-hmac/%d' %
                          (conf['hash'],
@@ -360,7 +362,7 @@ def cmd_newmaster(args):
   run('''key -kmaster add
     -a${sig-genalg} !${sig-param}
     -e${sig-expire} !${master-keygen-flags} -tmaster-%d tripe-keys-master
-    sig=${sig} hash=${sig-hash}''' % seq)
+    sig=${sig} hash=${sig-hash} !${master-attrs}''' % seq)
   run('key -kmaster extract -f-secret repos/master.pub')
 
 ###--------------------------------------------------------------------------
@@ -371,7 +373,8 @@ def cmd_setup(args):
   run('''key -krepos/param add
     -a${kx-param-genalg} !${kx-param}
     -eforever -tparam tripe-param
-    kx-group=${kx} cipher=${cipher} hash=${hash} mac=${mac} mgf=${mgf}''')
+    kx-group=${kx} mgf=${mgf} mac=${mac}
+    cipher=${cipher} hash=${hash} ${kx-attrs}''')
   cmd_newmaster(args)
 
 ###--------------------------------------------------------------------------