Skip to main content
Credit Card Fraud Model Configuration for Encrypted InputsCryptography Fundamentals
4 min readFor Fraud Risk Managers

Credit Card Fraud Model Configuration for Encrypted Inputs

Your fraud detection model needs to analyze transaction patterns without accessing cardholder data. Here's a configuration template that uses homomorphic encryption for inference workloads, allowing your model to score transactions while keeping the Primary Account Number (PAN), CVV, and transaction amounts encrypted end-to-end.

Purpose of This Configuration

This template configures a fraud scoring model to operate on encrypted transaction data using homomorphic encryption. It's designed for fraud risk managers who need to:

  • Run real-time fraud scoring without decrypting cardholder data in memory
  • Maintain PCI DSS Requirement 3.4 compliance (PAN unreadable anywhere it's stored)
  • Process transactions across third-party analytics platforms without data exposure
  • Enable fraud analysis in jurisdictions with strict data localization requirements

The configuration converts a standard fraud model (trained on plaintext features) into one that accepts encrypted inputs and returns encrypted risk scores. Your authorization system decrypts only the final score, never the underlying transaction details.

Prerequisites

Before implementing this configuration, ensure:

  1. Model architecture compatibility: Your fraud model uses operations supported by homomorphic encryption (addition, multiplication, polynomial approximations). Models relying heavily on branching logic or comparison operations require additional preprocessing layers.

  2. Key management infrastructure: You need a Key Encryption Key (KEK) hierarchy that supports homomorphic encryption key generation. Your Hardware Security Module (HSM) must generate and protect the evaluation keys used for encrypted computation.

  3. Performance baseline: Document your current inference latency. While the cost of homomorphic encryption is decreasing, you'll still see computational overhead. Establish acceptable latency thresholds before deployment.

  4. Data encryption at source: Your payment gateway or point-of-sale system must encrypt transaction data before transmission. This configuration assumes data arrives already encrypted, it doesn't handle the initial encryption step.

Configuration Template

fraud_model_config:
  model_identifier: "transaction_risk_v3_encrypted"
  
  encryption_scheme:
    type: "FHE"  # Fully Homomorphic Encryption
    library: "SEAL"  # Microsoft SEAL or equivalent
    security_level: 128  # bits
    
  input_features:
    - feature_name: "transaction_amount"
      data_type: "encrypted_integer"
      encoding: "batched"
      precision: 2  # decimal places
      
    - feature_name: "merchant_category_code"
      data_type: "encrypted_categorical"
      encoding: "one_hot_encrypted"
      categories: 18  # MCC groups
      
    - feature_name: "time_since_last_transaction"
      data_type: "encrypted_integer"
      encoding: "batched"
      unit: "minutes"
      
    - feature_name: "card_present_flag"
      data_type: "encrypted_binary"
      encoding: "single_bit"
      
    - feature_name: "cross_border_flag"
      data_type: "encrypted_binary"
      encoding: "single_bit"
      
  model_operations:
    layer_1:
      operation: "encrypted_linear_transformation"
      weights: "preloaded_encrypted_weights_layer1.bin"
      activation: "polynomial_approximation"  # ReLU approximation
      
    layer_2:
      operation: "encrypted_linear_transformation"
      weights: "preloaded_encrypted_weights_layer2.bin"
      activation: "polynomial_approximation"
      
    output_layer:
      operation: "encrypted_linear_transformation"
      weights: "preloaded_encrypted_weights_output.bin"
      output_format: "encrypted_probability"
      threshold_comparison: "server_side_only"  # decrypt before threshold
      
  key_management:
    evaluation_key_source: "hsm://fraud-scoring-kek/eval-keys"
    key_rotation_interval: "90_days"
    key_backup_location: "hsm://fraud-scoring-kek/backup"
    
  performance_parameters:
    max_inference_latency_ms: 500
    batch_size: 1  # real-time scoring
    threading: "enabled"
    hardware_acceleration: "gpu_preferred"
    
  logging_and_monitoring:
    log_encrypted_inputs: false  # never log encrypted data
    log_decrypted_scores: true
    log_inference_latency: true
    alert_on_latency_threshold: 450  # ms
    alert_on_decryption_failure: true

Customizing the Configuration

Adjust feature encoding: If your fraud model uses continuous features (like transaction velocity or average ticket size), set encoding: "batched" and specify precision. Categorical features (MCC, country code, card brand) need encoding: "one_hot_encrypted" with the category count.

Match security level to your threat model: The security_level: 128 parameter defines cryptographic strength. Financial institutions processing high-value transactions should consider 256-bit security, though this increases computational cost. Consult your cryptography team before changing this value.

Tune latency vs. accuracy trade-offs: The polynomial_approximation activation function replaces non-linear operations (like ReLU or sigmoid) with polynomial equivalents. Higher-degree polynomials improve accuracy but increase latency. Start with degree-3 polynomials and measure both false positive rates and inference time.

Configure threshold logic carefully: The threshold_comparison: "server_side_only" setting means your system decrypts the risk score before comparing it to your decline threshold. This is necessary because comparison operations on encrypted values are computationally expensive. Your authorization system must handle this decryption in a PCI DSS-compliant environment (Requirement 3.5.1: cryptographic keys stored separately from encrypted data).

Set realistic latency alerts: Homomorphic encryption adds computational overhead. If your current fraud model scores transactions in 50ms, expect 200-500ms with encrypted inference. Configure alerts above your acceptable threshold, not at your old baseline.

Validation Steps

  1. Accuracy verification: Run your test dataset through both the plaintext and encrypted models. The encrypted model's predictions should match the plaintext model within your specified precision (typically ±0.01 for probability scores). Divergence beyond this threshold indicates encoding or approximation errors.

  2. Latency profiling: Measure inference time across your expected transaction volume. Test peak-load scenarios (Black Friday, holiday shopping) to verify performance under stress. If latency exceeds your threshold, consider batching multiple transactions or upgrading to GPU acceleration.

  3. Key rotation testing: Simulate a key rotation event in your staging environment. Verify that new evaluation keys load correctly and that in-flight transactions complete successfully. Your model should handle key transitions without dropping transactions.

  4. Decryption failure handling: Inject corrupted encrypted inputs to test error handling. Your system should log the failure, reject the transaction with a generic error (never expose that decryption failed), and alert your security operations team.

  5. PCI DSS validation: Confirm that cardholder data remains encrypted throughout the scoring process. Your QSA should verify that PAN never appears in plaintext in application memory, logs, or debug outputs. This configuration supports Requirement 3.4 compliance, but you're responsible for the surrounding infrastructure.

This configuration provides a starting point for encrypted fraud scoring. You'll need to adapt feature encodings, tune performance parameters, and validate accuracy against your specific model architecture, but the framework handles the core challenge of scoring transactions you can't see.

You Might Also Like