Skip to content

Commit

Permalink
src - Add ec point formats to registry
Browse files Browse the repository at this point in the history
  • Loading branch information
phibos committed Feb 23, 2015
1 parent 34f6f5c commit d404fe0
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
24 changes: 24 additions & 0 deletions flextls/_registry/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ def __init__(self):
"ec.named_curves",
ECNamedCurveRegistry()
)
self.register(
"ec.point_formats",
ECPointFormatRegistry()
)

reg = ProtocolVersionRegistry()
self.register(
Expand Down Expand Up @@ -80,6 +84,7 @@ def __init__(self):
self.register("version.SSL", ssl_id)
self.register("version.TLS", tls_id)


class BaseRegistry(object):
def __init__(self):
self._values = []
Expand Down Expand Up @@ -235,6 +240,15 @@ def __init__(self, auto_load=True):
self.load(ec_named_curves, replace=True)


class ECPointFormatRegistry(BaseRegistry):
def __init__(self, auto_load=True):
BaseRegistry.__init__(self)
self._item_cls = ECPointFormat
if auto_load:
from flextls._registry.data import ec_point_formats
self.load(ec_point_formats, replace=True)


class CipherSuite(object):
def __init__(self, id, protocol=None, name=None, bits=None, alg_bits=None,
key_exchange=None, authentication=None, encryption=None,
Expand Down Expand Up @@ -281,6 +295,16 @@ def __init__(self, id, **kwargs):
BaseRegistryItem.__init__(self, id, **kwargs)


class ECPointFormat(BaseRegistryItem):
"""
EC Point Format
RFC4492
"""
def __init__(self, id, **kwargs):
BaseRegistryItem.__init__(self, id, **kwargs)


class ProtocolVersion(BaseRegistryItem):
def __init__(self, id, version_id=None, **kwargs):
BaseRegistryItem.__init__(self, id, **kwargs)
Expand Down
21 changes: 21 additions & 0 deletions flextls/_registry/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -3842,3 +3842,24 @@
"references": ["RFC4492"],
},
]

ec_point_formats = [
{
"id": 0,
"name": "uncompressed",
"dtls": True,
"references": ["RFC4492"],
},
{
"id": 1,
"name": "ansiX962_compressed_prime",
"dtls": True,
"references": ["RFC4492"],
},
{
"id": 2,
"name": "ansiX962_compressed_char2",
"dtls": True,
"references": ["RFC4492"],
},
]

0 comments on commit d404fe0

Please sign in to comment.