@@ -66,21 +66,20 @@ def sha512_digest(msg):
66
66
67
67
def generate_and_store_rsa_key (key_size = 2048 , filename = 'rsa.key' ,
68
68
passphrase = '' ):
69
- private_key = rsa .generate_private_key (public_exponent = 65537 ,
70
- key_size = key_size ,
71
- backend = default_backend ())
69
+ private_key = rsa .generate_private_key (public_exponent = 65537 ,
70
+ key_size = key_size ,
71
+ backend = default_backend ())
72
72
73
73
with open (filename , "wb" ) as keyfile :
74
74
if passphrase :
75
75
pem = private_key .private_bytes (
76
- encoding = serialization .Encoding .PEM ,
77
- format = serialization .PrivateFormat .PKCS8 ,
78
- encryption_algorithm = serialization .BestAvailableEncryption (
79
- passphrase ))
76
+ encoding = serialization .Encoding .PEM ,
77
+ format = serialization .PrivateFormat .PKCS8 ,
78
+ encryption_algorithm = serialization .BestAvailableEncryption (passphrase ))
80
79
else :
81
80
pem = private_key .private_bytes (
82
- encoding = serialization .Encoding .PEM ,
83
- format = serialization .PrivateFormat .PKCS8 ,
81
+ encoding = serialization .Encoding .PEM ,
82
+ format = serialization .PrivateFormat .PKCS8 ,
84
83
encryption_algorithm = serialization .NoEncryption ())
85
84
keyfile .write (pem )
86
85
keyfile .close ()
@@ -968,7 +967,7 @@ def __eq__(self, other):
968
967
if isinstance (other .key , ec .EllipticCurvePublicKey ):
969
968
if self .key .curve != other .key .curve :
970
969
return False
971
- if self .key .key_size != other .key .key_size :
970
+ if self .key .key_size != other .key .key_size :
972
971
return False
973
972
if self .key .public_numbers () != other .key .public_numbers ():
974
973
return False
@@ -978,7 +977,7 @@ def __eq__(self, other):
978
977
if isinstance (other .key , ec .EllipticCurvePrivateKey ):
979
978
if self .key .curve != other .key .curve :
980
979
return False
981
- if self .key .key_size != other .key .key_size :
980
+ if self .key .key_size != other .key .key_size :
982
981
return False
983
982
if self .key .private_numbers () != other .key .private_numbers ():
984
983
return False
0 commit comments