Skip to content

Commit

Permalink
Frealm2 (#1565)
Browse files Browse the repository at this point in the history
* reduce log noise
* forward channel_binding selected in Component client
* expand ISigningKey to provide security_module/key_id (if used)
* fix Component cryptosign test
* add type hints; fix channel_binding
* work on federated realms and secmods
* rename to and work on a.w.CryptosignKey
* add bip44 for cryptosign test
  • Loading branch information
oberstet committed May 13, 2022
1 parent 31d36af commit 05da974
Show file tree
Hide file tree
Showing 16 changed files with 1,351 additions and 219 deletions.
File renamed without changes.
25 changes: 0 additions & 25 deletions autobahn/asyncio/test/__init__.py

This file was deleted.

6 changes: 3 additions & 3 deletions autobahn/asyncio/websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ class WebSocketAdapterProtocol(asyncio.Protocol):
def connection_made(self, transport):
# asyncio networking framework entry point, called by asyncio
# when the connection is established (either a client or a server)
self.log.info('{func}(transport={transport})', func=hltype(self.connection_made),
transport=transport)
self.log.debug('{func}(transport={transport})', func=hltype(self.connection_made),
transport=transport)

self.transport = transport

Expand Down Expand Up @@ -212,7 +212,7 @@ class WebSocketClientProtocol(WebSocketAdapterProtocol, protocol.WebSocketClient

def _onConnect(self, response):
res = self.onConnect(response)
self.log.info('{func}: {res}', func=hltype(self._onConnect), res=res)
self.log.debug('{func}: {res}', func=hltype(self._onConnect), res=res)
if yields(res):
asyncio.ensure_future(res)

Expand Down
8 changes: 4 additions & 4 deletions autobahn/twisted/cryptosign.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
###############################################################################


from autobahn.wamp.cryptosign import HAS_CRYPTOSIGN, SigningKey
from autobahn.wamp.cryptosign import HAS_CRYPTOSIGN, CryptosignKey

from twisted.internet.defer import inlineCallbacks, returnValue

Expand All @@ -45,7 +45,7 @@
HAS_CRYPTOSIGN_SSHAGENT = False
else:
HAS_CRYPTOSIGN_SSHAGENT = True
__all__.append('SSHAgentSigningKey')
__all__.append('SSHAgentCryptosignKey')


if HAS_CRYPTOSIGN_SSHAGENT:
Expand All @@ -54,7 +54,7 @@
from nacl import signing
from autobahn.wamp.cryptosign import _read_ssh_ed25519_pubkey, _unpack, _pack

class SSHAgentSigningKey(SigningKey):
class SSHAgentCryptosignKey(CryptosignKey):
"""
A WAMP-cryptosign signing key that is a proxy to a private Ed25510 key
actually held in SSH agent.
Expand All @@ -65,7 +65,7 @@ class SSHAgentSigningKey(SigningKey):
"""

def __init__(self, key, comment=None, reactor=None):
SigningKey.__init__(self, key, comment)
CryptosignKey.__init__(self, key, comment)
if not reactor:
from twisted.internet import reactor
self._reactor = reactor
Expand Down
4 changes: 2 additions & 2 deletions autobahn/twisted/wamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -834,8 +834,8 @@ def __init__(self, **kw):
"Unexpected key '{}' in 'authextra'".format(key)
)

from autobahn.wamp.cryptosign import SigningKey
self._privkey = SigningKey.from_key_bytes(
from autobahn.wamp.cryptosign import CryptosignKey
self._privkey = CryptosignKey.from_bytes(
binascii.a2b_hex(kw['privkey'])
)

Expand Down
8 changes: 5 additions & 3 deletions autobahn/wamp/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ def __init__(self, **kw):
"Must provide '{}' for cryptosign".format(key)
)

from autobahn.wamp.cryptosign import SigningKey
self._privkey = SigningKey.from_key_bytes(
from autobahn.wamp.cryptosign import CryptosignKey
self._privkey = CryptosignKey.from_bytes(
binascii.a2b_hex(kw['privkey'])
)

Expand All @@ -187,14 +187,16 @@ def __init__(self, **kw):
else:
kw['authextra'] = kw.get('authextra', dict())
kw['authextra']['pubkey'] = self._privkey.public_key()

self._channel_binding = kw.get('authextra', dict()).get('channel_binding', None)
self._args = kw

@property
def authextra(self):
return self._args.get('authextra', dict())

def on_challenge(self, session, challenge):
return self._privkey.sign_challenge(session, challenge)
return self._privkey.sign_challenge(session, challenge, channel_id_type=self._channel_binding)

def on_welcome(self, msg, authextra):
return None
Expand Down

0 comments on commit 05da974

Please sign in to comment.