Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

SignerRSAUpgradeable

Inherits: Initializable, AbstractSigner

*Implementation of {AbstractSigner} using xref:api:utils/cryptography#RSA[RSA] signatures. For {Account} usage, a {_setSigner} function is provided to set the {signer} public key. Doing so is easier for a factory, who is likely to use initializable clones of this contract. Example of usage:

contract MyAccountRSA is Account, SignerRSA, Initializable {
function initialize(bytes memory e, bytes memory n) public initializer {
_setSigner(e, n);
}
}

IMPORTANT: Failing to call {_setSigner} either during construction (if used standalone) or during initialization (if used as a clone) may leave the signer either front-runnable or unusable.*

State Variables

SignerRSAStorageLocation

bytes32 private constant SignerRSAStorageLocation = 0x8bf15870295cd9a811d81afc339672ef68c88b80db19b9fcfad708cc10d31600;

Functions

_getSignerRSAStorage

function _getSignerRSAStorage() private pure returns (SignerRSAStorage storage $);

__SignerRSA_init

function __SignerRSA_init(bytes memory e, bytes memory n) internal onlyInitializing;

__SignerRSA_init_unchained

function __SignerRSA_init_unchained(bytes memory e, bytes memory n) internal onlyInitializing;

_setSigner

Sets the signer with a RSA public key. This function should be called during construction or through an initializer.

function _setSigner(bytes memory e, bytes memory n) internal;

signer

Return the signer's RSA public key.

function signer() public view virtual returns (bytes memory e, bytes memory n);

_rawSignatureValidation

See AbstractSigner-_rawSignatureValidation. Verifies a PKCSv1.5 signature by calling xref:api:utils/cryptography.adoc#RSA-pkcs1Sha256-bytes-bytes-bytes-bytes-[RSA.pkcs1Sha256]. IMPORTANT: Following the RSASSA-PKCS1-V1_5-VERIFY procedure outlined in RFC8017 (section 8.2.2), the provided hash is used as the M (message) and rehashed using SHA256 according to EMSA-PKCS1-v1_5 encoding as per section 9.2 (step 1) of the RFC.

function _rawSignatureValidation(bytes32 hash, bytes calldata signature)
    internal
    view
    virtual
    override
    returns (bool);

Structs

SignerRSAStorage

Note: storage-location: erc7201:openzeppelin.storage.SignerRSA

struct SignerRSAStorage {
    bytes _e;
    bytes _n;
}