Add clearer indication of "self encryption"
This commit is contained in:
parent
8e913a3faa
commit
0fa3331b8c
|
@ -2,6 +2,15 @@ class SecioException(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class SelfEncryption(SecioException):
|
||||||
|
"""
|
||||||
|
Raised to indicate that a host is attempting to encrypt communications
|
||||||
|
with itself.
|
||||||
|
"""
|
||||||
|
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class PeerMismatchException(SecioException):
|
class PeerMismatchException(SecioException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ from .exceptions import (
|
||||||
InvalidSignatureOnExchange,
|
InvalidSignatureOnExchange,
|
||||||
PeerMismatchException,
|
PeerMismatchException,
|
||||||
SecioException,
|
SecioException,
|
||||||
|
SelfEncryption,
|
||||||
)
|
)
|
||||||
from .pb.spipe_pb2 import Exchange, Propose
|
from .pb.spipe_pb2 import Exchange, Propose
|
||||||
|
|
||||||
|
@ -195,9 +196,8 @@ def _select_encryption_parameters(
|
||||||
elif second_score < first_score:
|
elif second_score < first_score:
|
||||||
order = 1
|
order = 1
|
||||||
|
|
||||||
# NOTE: if order is 0, "talking to self"
|
if order == 0:
|
||||||
# TODO(ralexstokes) nicer error handling here...
|
raise SelfEncryption()
|
||||||
assert order != 0
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
_select_parameter_from_order(
|
_select_parameter_from_order(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user