src/securityPolicy.c
security_policy_t policyForSignTxCertificate(
        sign_tx_signingmode_t txSigningMode,
        const certificate_type_t certificateType
)
{
	switch (txSigningMode) {

	case SIGN_TX_SIGNINGMODE_PLUTUS_TX:
	case SIGN_TX_SIGNINGMODE_ORDINARY_TX:
		// pool registration is allowed only in POOL_REGISTRATION signging modes
		DENY_IF(certificateType == CERTIFICATE_TYPE_STAKE_POOL_REGISTRATION);
		ALLOW();
		break;

	case SIGN_TX_SIGNINGMODE_MULTISIG_TX:
		// pool registration is allowed only in POOL_REGISTRATION signging modes
		DENY_IF(certificateType == CERTIFICATE_TYPE_STAKE_POOL_REGISTRATION);
		// pool retirement is impossible with multisig keys
		DENY_IF(certificateType == CERTIFICATE_TYPE_STAKE_POOL_RETIREMENT);
		ALLOW();
		break;

	case SIGN_TX_SIGNINGMODE_POOL_REGISTRATION_OPERATOR:
	case SIGN_TX_SIGNINGMODE_POOL_REGISTRATION_OWNER:
		// only pool registration is allowed
		DENY_UNLESS(certificateType == CERTIFICATE_TYPE_STAKE_POOL_REGISTRATION);
		ALLOW();
		break;

	default:
		ASSERT(false);
	}

	DENY(); // should not be reached
}
// a generic policy for all certificates
// does not evaluate aspects of specific certificates
a generic policy for all certificates
does not evaluate aspects of specific certificates
a generic policy for all certificates does not evaluate aspects of specific certificates
security_policy_t policyForSignTxCertificate(
        sign_tx_signingmode_t txSigningMode,
        const certificate_type_t certificateType
)
{
	switch (txSigningMode) {
	case SIGN_TX_SIGNINGMODE_PLUTUS_TX:
	case SIGN_TX_SIGNINGMODE_ORDINARY_TX:
		DENY_IF(certificateType == CERTIFICATE_TYPE_STAKE_POOL_REGISTRATION);
		ALLOW();
		break;
	case SIGN_TX_SIGNINGMODE_MULTISIG_TX:
		DENY_IF(certificateType == CERTIFICATE_TYPE_STAKE_POOL_REGISTRATION);
		DENY_IF(certificateType == CERTIFICATE_TYPE_STAKE_POOL_RETIREMENT);
		ALLOW();
		break;
	case SIGN_TX_SIGNINGMODE_POOL_REGISTRATION_OPERATOR:
	case SIGN_TX_SIGNINGMODE_POOL_REGISTRATION_OWNER:
		DENY_UNLESS(certificateType == CERTIFICATE_TYPE_STAKE_POOL_REGISTRATION);
		ALLOW();
		break;
	default:
		ASSERT(false);
	}
	DENY(); 
}
security_policy_t policyForSignTxCertificate ( sign_tx_signingmode_t txSigningMode , const certificate_type_t certificateType ) { switch ( txSigningMode ) { case SIGN_TX_SIGNINGMODE_PLUTUS_TX : case SIGN_TX_SIGNINGMODE_ORDINARY_TX : DENY_IF ( certificateType == CERTIFICATE_TYPE_STAKE_POOL_REGISTRATION ) ; ALLOW ( ) ; break ; case SIGN_TX_SIGNINGMODE_MULTISIG_TX : DENY_IF ( certificateType == CERTIFICATE_TYPE_STAKE_POOL_REGISTRATION ) ; DENY_IF ( certificateType == CERTIFICATE_TYPE_STAKE_POOL_RETIREMENT ) ; ALLOW ( ) ; break ; case SIGN_TX_SIGNINGMODE_POOL_REGISTRATION_OPERATOR : case SIGN_TX_SIGNINGMODE_POOL_REGISTRATION_OWNER : DENY_UNLESS ( certificateType == CERTIFICATE_TYPE_STAKE_POOL_REGISTRATION ) ; ALLOW ( ) ; break ; default : ASSERT ( false ) ; } DENY ( ) ; }
a generic policy for all certificates
does not evaluate aspects of specific certificates
a generic policy for all certificates does not evaluate aspects of specific certificates
// pool registration is allowed only in POOL_REGISTRATION signging modes // pool registration is allowed only in POOL_REGISTRATION signging modes // pool retirement is impossible with multisig keys // only pool registration is allowed // should not be reached