org.shoulder.crypto.negotiation.dto.NegotiationResult Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of shoulder-crypto-negotiation Show documentation
Show all versions of shoulder-crypto-negotiation Show documentation
Shoulder 提供的 协商加密模块,用于非信任网络环境下的安全通信。基于 DH + ECC 实现先进的加密算法协商算法,比传统的 DH + DES 协商算法性能显著更高,更安全。
package org.shoulder.crypto.negotiation.dto;
import lombok.Data;
import java.io.Serializable;
/**
* 协商完成后用于缓存的数据
*
* @author lym
*/
@Data
public class NegotiationResult implements Serializable {
/**
* 对方的公钥
*/
private byte[] otherPublicKey;
/**
* 协商标识
*/
private String xSessionId;
/**
* 协商结果key,会话双方的共享密钥
*/
private byte[] shareKey;
/**
* 协商结果向量
*/
private byte[] localIv;
/**
* 本次会话中,报文的加密方式
* 一般为对称加密算法,如 AES-256
*/
private String encryptionScheme;
/**
* 协商结果key长度 256/8=32
*/
private int keyLength;
/**
* 过期的时间点
*/
private long expireTime;
public NegotiationResult() {
}
public NegotiationResult(String xSessionId, byte[] shareKey, byte[] localIv, int keyLength, int expireTime) {
this.xSessionId = xSessionId;
setShareKey(shareKey);
setLocalIv(localIv);
this.expireTime = expireTime;
this.keyLength = keyLength;
}
public byte[] getShareKey() {
return shareKey == null ? null : shareKey.clone();
}
public void setShareKey(byte[] shareKey) {
this.shareKey = shareKey == null ? null : shareKey.clone();
}
public byte[] getLocalIv() {
return localIv == null ? null : localIv.clone();
}
public void setLocalIv(byte[] localIv) {
this.localIv = localIv == null ? null : localIv.clone();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy