package com.sunyard.chsm.param;

import com.sunyard.chsm.enums.AlgMode;
import com.sunyard.chsm.enums.Padding;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

@Data
public class SymDecryptReq {
    // 密钥ID
    @NotNull(message = "密钥ID不能为空")
    private Long keyId;

    // 密钥索引
    @NotEmpty(message = "密钥索引不能为空")
    @Size(min = 15, max = 24, message = "密钥索引长度在15-24")
    private String keyIndex;

    // 密文,使用Base64编码
    @NotBlank(message = "密文不能为空")
    private String cipherData;

    // 填充方式, 默认PCKS7
    @NotNull(message = "填充方式不能为空")
    private Padding padding = Padding.PCKS7Padding;

    // 加密模式, 默认ECB
    @NotNull(message = "加密模式不能为空")
    private AlgMode mode = AlgMode.ECB;

    // iv,CBC模式下不能为空,Base64编码
    private String iv;
}
