Skip to content
This repository was archived by the owner on Apr 20, 2025. It is now read-only.
This repository was archived by the owner on Apr 20, 2025. It is now read-only.

Blinding uses slow algorithm #162

Closed
Closed
@tomato42

Description

@tomato42

The private key operations generate a new blinding factor for every new signature:

python-rsa/rsa/key.py

Lines 440 to 453 in 4beb68d

def blinded_encrypt(self, message: int) -> int:
"""Encrypts the message using blinding to prevent side-channel attacks.
:param message: the message to encrypt
:type message: int
:returns: the encrypted message
:rtype: int
"""
blind_r = self._get_blinding_factor()
blinded = self.blind(message, blind_r) # blind before encrypting
encrypted = rsa.core.encrypt_int(blinded, self.d, self.n)
return self.unblind(encrypted, blind_r)

Given that blinding requires calculating inverse modulo of of the blinding factor, it is a slow operation (rule of thumb is that inverse is as costly as calculating 100 modulo multiplications).

The existing literature[1] (section 9) suggests generating a blinding factor, its inverse, and then squaring both of them for next operation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions