mirror of
https://gitee.com/willfree/min-dev-java.git
synced 2026-10-04 19:42:01 +08:00
182 lines
4.6 KiB
Java
182 lines
4.6 KiB
Java
package minsecurity.certificate.cert;
|
|
|
|
import minsecurity.crypto.PublicKeyInterface;
|
|
import org.bouncycastle.pqc.math.linearalgebra.ByteUtils;
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
/*
|
|
* @Author: hongyu guo
|
|
* @Description: 证书bean类
|
|
* @Version: 1.0.0
|
|
* @Date: 17:05 2021/03/05
|
|
* @Copyright: MIN-Group;国家重大科技基础设施——未来网络北大实验室;深圳市信息论与未来网络重点实验室
|
|
*/
|
|
public class Certificate {
|
|
private static final org.slf4j.Logger logger = LoggerFactory.getLogger(Certificate.class);
|
|
|
|
private int version;
|
|
private long serialNumber;
|
|
private PublicKeyInterface publicKey;
|
|
private byte[] signature;
|
|
private int signatureAlgorithm;
|
|
private int publicKeyAlgorithm;
|
|
private String issueTo;
|
|
private String issuer;
|
|
private long notBefore;
|
|
private long notAfter;
|
|
private int keyUsage;
|
|
private boolean isCA;
|
|
private long timestamp;
|
|
|
|
public Certificate() {
|
|
}
|
|
|
|
public Certificate(int version, long serialNumber,
|
|
PublicKeyInterface publicKey,
|
|
byte[] signature, int signatureAlgorithm,
|
|
int publicKeyAlgorithm,
|
|
String issueTo, String issuer,
|
|
long notBefore, long notAfter,
|
|
int keyUsage, boolean isCA, long timestamp) {
|
|
this.version = version;
|
|
this.serialNumber = serialNumber;
|
|
this.publicKey = publicKey;
|
|
this.signature = signature;
|
|
this.signatureAlgorithm = signatureAlgorithm;
|
|
this.publicKeyAlgorithm = publicKeyAlgorithm;
|
|
this.issueTo = issueTo;
|
|
this.issuer = issuer;
|
|
this.notBefore = notBefore;
|
|
this.notAfter = notAfter;
|
|
this.keyUsage = keyUsage;
|
|
this.isCA = isCA;
|
|
this.timestamp = timestamp;
|
|
}
|
|
|
|
public int getVersion() {
|
|
return version;
|
|
}
|
|
|
|
public void setVersion(int version) {
|
|
this.version = version;
|
|
}
|
|
|
|
public long getSerialNumber() {
|
|
return serialNumber;
|
|
}
|
|
|
|
public void setSerialNumber(long serialNumber) {
|
|
this.serialNumber = serialNumber;
|
|
}
|
|
|
|
|
|
public byte[] getSignature() {
|
|
return signature;
|
|
}
|
|
|
|
public void setSignature(byte[] signature) {
|
|
this.signature = signature;
|
|
}
|
|
|
|
public int getSignatureAlgorithm() {
|
|
return signatureAlgorithm;
|
|
}
|
|
|
|
public void setSignatureAlgorithm(int signatureAlgorithm) {
|
|
this.signatureAlgorithm = signatureAlgorithm;
|
|
}
|
|
|
|
public int getPublicKeyAlgorithm() {
|
|
return publicKeyAlgorithm;
|
|
}
|
|
|
|
public void setPublicKeyAlgorithm(int publicKeyAlgorithm) {
|
|
this.publicKeyAlgorithm = publicKeyAlgorithm;
|
|
}
|
|
|
|
public String getIssueTo() {
|
|
return issueTo;
|
|
}
|
|
|
|
public void setIssueTo(String issueTo) {
|
|
this.issueTo = issueTo;
|
|
}
|
|
|
|
public String getIssuer() {
|
|
return issuer;
|
|
}
|
|
|
|
public void setIssuer(String issuer) {
|
|
this.issuer = issuer;
|
|
}
|
|
|
|
public long getNotBefore() {
|
|
return notBefore;
|
|
}
|
|
|
|
public void setNotBefore(long notBefore) {
|
|
this.notBefore = notBefore;
|
|
}
|
|
|
|
public long getNotAfter() {
|
|
return notAfter;
|
|
}
|
|
|
|
public void setNotAfter(long notAfter) {
|
|
this.notAfter = notAfter;
|
|
}
|
|
|
|
public int getKeyUsage() {
|
|
return keyUsage;
|
|
}
|
|
|
|
public void setKeyUsage(int keyUsage) {
|
|
this.keyUsage = keyUsage;
|
|
}
|
|
|
|
public boolean isCA() {
|
|
return isCA;
|
|
}
|
|
|
|
public void setCA(boolean CA) {
|
|
isCA = CA;
|
|
}
|
|
|
|
public long getTimestamp() {
|
|
return timestamp;
|
|
}
|
|
|
|
public void setTimestamp(long timestamp) {
|
|
this.timestamp = timestamp;
|
|
}
|
|
|
|
public PublicKeyInterface getPublicKey() {
|
|
return publicKey;
|
|
}
|
|
|
|
public void setPublicKey(PublicKeyInterface publicKey) {
|
|
this.publicKey = publicKey;
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return "Certificate{" +
|
|
"version=" + version +
|
|
", serialNumber=" + serialNumber +
|
|
", publicKey=" + publicKey +
|
|
", signature=" + ByteUtils.toHexString(signature) +
|
|
", signatureAlgorithm=" + signatureAlgorithm +
|
|
", publicKeyAlgorithm=" + publicKeyAlgorithm +
|
|
", issueTo='" + issueTo + '\'' +
|
|
", issuer='" + issuer + '\'' +
|
|
", notBefore=" + notBefore +
|
|
", notAfter=" + notAfter +
|
|
", keyUsage=" + keyUsage +
|
|
", isCA=" + isCA +
|
|
", timestamp=" + timestamp +
|
|
'}';
|
|
}
|
|
|
|
}
|