Class PolicyViolationException

All Implemented Interfaces:
Serializable

public final class PolicyViolationException extends OpenCryptoException
Exception thrown when a cryptographic operation violates the configured policy. 当加密操作违反配置的策略时抛出的异常。

Contains the algorithm that violated the policy and a descriptive message explaining why the operation was denied.

包含违反策略的算法以及解释操作被拒绝原因的描述性消息。

Features | 主要功能:

  • Carries violated algorithm context - 携带违规算法上下文
  • Integrates with CryptoPolicy enforcement - 与 CryptoPolicy 执行集成

Usage Examples | 使用示例:

throw new PolicyViolationException("MD5", "check", "Algorithm MD5 is not allowed by current policy");

Security | 安全性:

  • Thread-safe: Yes - 线程安全: 是
Since:
JDK 25, opencode-base-crypto V1.0.3
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Constructor Details

    • PolicyViolationException

      public PolicyViolationException(String algorithm, String operation, String message)
      Constructs a PolicyViolationException with algorithm, operation, and message. 使用算法、操作和消息构造策略违规异常。
      Parameters:
      algorithm - the algorithm that violated the policy | 违反策略的算法
      operation - the operation being performed | 正在执行的操作
      message - the detail message | 详细消息
  • Method Details

    • getViolatedAlgorithm

      public String getViolatedAlgorithm()
      Returns the algorithm that violated the policy. 返回违反策略的算法。
      Returns:
      the violated algorithm name | 违规算法名称