Example #1
0
    def hmac_type(self, val=None):
        """Get or set the spa_hmac_type

        This is an integer value. If no argument is given, the current value
        is returned.  Otherwise, the SPA message client timeout value will
        be set to the given value.
        """
        if val != None:
            _fko.set_spa_hmac_type(self.ctx, val)
        else:
            return _fko.get_spa_hmac_type(self.ctx)
Example #2
0
    def hmac_type(self, val=None):
        """Get or set the spa_hmac_type

        This is an integer value. If no argument is given, the current value
        is returned.  Otherwise, the SPA message client timeout value will
        be set to the given value.
        """
        if val != None:
            _fko.set_spa_hmac_type(self.ctx, val)
        else:
            return _fko.get_spa_hmac_type(self.ctx)
Example #3
0
File: fko.py Project: PKRoma/fwknop
    def spa_data_final(self, key, hmac_key):
        """Perform final processing and generation of the SPA message data.

        This function is the final step in creating a complete encrypted
        SPA data string suitable for transmission to an fwknop server.  It
        does require all of the requisite SPA data fields be set. Otherwise,
        it will fail and throw an fko.error exception. We do set the default
        HMAC digest to SHA256 if an HMAC key was provided and the HMAC mode
        was not already set.
        """
        if hmac_key and not _fko.get_spa_hmac_type(self.ctx):
            _fko.set_spa_hmac_type(self.ctx, FKO_HMAC_SHA256)

        _fko.spa_data_final(self.ctx, key, hmac_key)
Example #4
0
    def spa_data_final(self, key, hmac_key):
        """Perform final processing and generation of the SPA message data.

        This function is the final step in creating a complete encrypted
        SPA data string suitable for transmission to an fwknop server.  It
        does require all of the requisite SPA data fields be set. Otherwise,
        it will fail and throw an fko.error exception. We do set the default
        HMAC digest to SHA256 if an HMAC key was provided and the HMAC mode
        was not already set.
        """
        if hmac_key and not _fko.get_spa_hmac_type(self.ctx):
            _fko.set_spa_hmac_type(self.ctx, FKO_HMAC_SHA256)

        _fko.spa_data_final(self.ctx, key, hmac_key)