Search in sources :

Example 1 with POPOSigningKeyInput

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()));
}
Also used : POPOSigningKeyInput(com.github.zhenwei.pkix.util.asn1.crmf.POPOSigningKeyInput) DERBitString(com.github.zhenwei.core.asn1.DERBitString) POPOSigningKey(com.github.zhenwei.pkix.util.asn1.crmf.POPOSigningKey)

Aggregations

DERBitString (com.github.zhenwei.core.asn1.DERBitString)1 POPOSigningKey (com.github.zhenwei.pkix.util.asn1.crmf.POPOSigningKey)1 POPOSigningKeyInput (com.github.zhenwei.pkix.util.asn1.crmf.POPOSigningKeyInput)1