'auto' is the same as None. This is helpful to samba-tool.
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
return pem.decode()
-def get_public_key(data:bytes, encoding:str):
+def get_public_key(data:bytes, encoding:Optional[str] = None) -> RSAPublicKey:
"""decode a key in PEM or DER format.
If it turns out to be a certificate or something, we try to get
if len(res) == 0:
raise ValueError(f"link target {target} does not exist")
+ if encoding == 'auto':
+ encoding = None
+
key = get_public_key(data, encoding)
if key.key_size != 2048: