From: Ian Jackson Date: Sat, 9 Nov 2019 00:03:49 +0000 (+0000) Subject: make-secnet-sites: Prepare for multiple public key types X-Git-Tag: v0.6.0~102 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=secnet.git;a=commitdiff_plain;h=79b8d68a8b64c76d929d776570afba963ae44647 make-secnet-sites: Prepare for multiple public key types * Introduce a general base typee for public keys. * Indirect public key object construction through a function which is suitable for passing to listof(), and which will despatch appropriately. This allows a heterogenous list. Signed-off-by: Ian Jackson --- diff --git a/make-secnet-sites b/make-secnet-sites index 0f1e8ba..b7720d2 100755 --- a/make-secnet-sites +++ b/make-secnet-sites @@ -413,7 +413,10 @@ class address (basetype): def __str__(self): return '"%s"; port %d'%(self.adr,self.port) -class rsakey (basetype): +class pubkey (basetype): + "Some kind of publie key" + +class rsakey (pubkey): "An RSA public key" def __init__(self,w): self.l=w[1].number(0,max['rsa_bits'],'rsa len') @@ -423,6 +426,12 @@ class rsakey (basetype): def __str__(self): return 'rsa-public("%s","%s")'%(self.e,self.n) +def somepubkey(w): + if w[0]=='pubkey': + return rsakey(w) + else: + assert(False) + # Possible properties of configuration nodes keywords={ 'contact':(email,"Contact address"), @@ -435,7 +444,7 @@ keywords={ 'renegotiate-time':(num,"Time after key setup to begin renegotiation (ms)"), 'restrict-nets':(networks,"Allowable networks"), 'networks':(networks,"Claimed networks"), - 'pubkey':(listof(rsakey),"RSA public site key"), + 'pubkey':(listof(somepubkey),"RSA public site key"), 'peer':(single_ipaddr,"Tunnel peer IP address"), 'address':(address,"External contact address and port"), 'mobile':(boolean,"Site is mobile"),