use of com.github.zhenwei.pkix.util.asn1.crmf.POPOSigningKeyInput in project LinLong-Java by zhenwei1108.
the class ProofOfPossessionSigningKeyBuilder method build.
public POPOSigningKey build(ContentSigner signer) {
if (name != null && publicKeyMAC != null) {
throw new IllegalStateException("name and publicKeyMAC cannot both be set.");
}
POPOSigningKeyInput popo;
if (certRequest != null) {
popo = null;
CRMFUtil.derEncodeToStream(certRequest, signer.getOutputStream());
} else if (name != null) {
popo = new POPOSigningKeyInput(name, pubKeyInfo);
CRMFUtil.derEncodeToStream(popo, signer.getOutputStream());
} else {
popo = new POPOSigningKeyInput(publicKeyMAC, pubKeyInfo);
CRMFUtil.derEncodeToStream(popo, signer.getOutputStream());
}
return new POPOSigningKey(popo, signer.getAlgorithmIdentifier(), new DERBitString(signer.getSignature()));
}
Aggregations