From 094cfe643780f3269e83e513cafd395bc51ec5ad Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 1 Dec 2019 18:45:44 +0000 Subject: [PATCH] make-secnet-sites: Write rsa1 keys as `pub rsa1 ...' in >=v2 This effectively deprecates the `pubkey' keyword, relegating it to a compatibility feature. Signed-off-by: Ian Jackson --- make-secnet-sites | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/make-secnet-sites b/make-secnet-sites index 2e07cf8..81d3679 100755 --- a/make-secnet-sites +++ b/make-secnet-sites @@ -431,12 +431,21 @@ class rsakey (pubkey): self.e=w[2].bignum_10('rsa','rsa e') self.n=w[3].bignum_10('rsa','rsa n') if len(w) >= 5: w[4].email() + self.a='rsa1' + self.d=base91s_encode(b'%d %s %s' % + (self.l, + self.e.encode('ascii'), + self.n.encode('ascii'))) + # ^ this allows us to use the pubkey.forsites() + # method for output in versions>=2 def __str__(self): return 'rsa-public("%s","%s")'%(self.e,self.n) # this specialisation means we can generate files # compatible with old secnet executables def forsites(self,version,xcopy,fs): - return ['pubkey', str(self.l), self.e, self.n] + if version < 2: + return ['pubkey', str(self.l), self.e, self.n] + return pubkey.forsites(self,version,xcopy,fs) def somepubkey(w): if w[0]=='pubkey': -- 2.30.2