- AesEncryption: AES-256-CBC 암호화/복호화 - RsaEncryption: RSA-2048 키 쌍 생성/암복호화 - E2EEService: 하이브리드 암복호화 (요청 복호화, 응답 암호화) - TimestampValidator: 타임스탬프 검증 (±30초) - SecureTransportAttribute: Action Filter (보안등급 3 엔드포인트용) - DI 등록: IE2EEService → E2EEService (Singleton) Closes #28
14 lines
405 B
C#
14 lines
405 B
C#
namespace SPMS.Infrastructure.Security;
|
|
|
|
public static class TimestampValidator
|
|
{
|
|
private static readonly TimeSpan Tolerance = TimeSpan.FromSeconds(30);
|
|
|
|
public static bool IsValid(long unixTimeSeconds)
|
|
{
|
|
var requestTime = DateTimeOffset.FromUnixTimeSeconds(unixTimeSeconds);
|
|
var diff = DateTimeOffset.UtcNow - requestTime;
|
|
return diff.Duration() <= Tolerance;
|
|
}
|
|
}
|