1 13 package org.ejbca.core.protocol.cmp; 14 15 import java.io.IOException ; 16 import java.security.InvalidKeyException ; 17 import java.security.NoSuchAlgorithmException ; 18 import java.security.NoSuchProviderException ; 19 import java.security.PrivateKey ; 20 import java.security.cert.CRL ; 21 import java.security.cert.Certificate ; 22 import java.security.cert.CertificateEncodingException ; 23 import java.security.cert.X509Certificate ; 24 25 import org.bouncycastle.asn1.DERNull; 26 import org.bouncycastle.asn1.x509.X509Name; 27 import org.ejbca.core.model.ca.SignRequestException; 28 import org.ejbca.core.model.ra.NotFoundException; 29 import org.ejbca.core.protocol.FailInfo; 30 import org.ejbca.core.protocol.IRequestMessage; 31 import org.ejbca.core.protocol.IResponseMessage; 32 import org.ejbca.core.protocol.ResponseStatus; 33 34 import com.novosec.pkix.asn1.cmp.PKIBody; 35 import com.novosec.pkix.asn1.cmp.PKIHeader; 36 import com.novosec.pkix.asn1.cmp.PKIMessage; 37 38 39 44 public class CmpConfirmResponseMessage extends BaseCmpMessage implements IResponseMessage { 45 46 55 static final long serialVersionUID = 10002L; 56 57 58 private byte[] responseMessage = null; 59 60 public void setCertificate(Certificate cert) { 61 } 62 63 public void setCrl(CRL crl) { 64 } 65 66 public void setIncludeCACert(boolean incCACert) { 67 } 68 69 public byte[] getResponseMessage() throws IOException , 70 CertificateEncodingException { 71 return responseMessage; 72 } 73 74 public void setStatus(ResponseStatus status) { 75 } 76 77 public ResponseStatus getStatus() { 78 return ResponseStatus.SUCCESS; 79 } 80 81 public void setFailInfo(FailInfo failInfo) { 82 } 83 84 public FailInfo getFailInfo() { 85 return null; 86 } 87 88 public void setFailText(String failText) { 89 } 90 91 public String getFailText() { 92 return null; 93 } 94 95 public boolean create() throws IOException , InvalidKeyException , 96 NoSuchAlgorithmException , NoSuchProviderException , 97 SignRequestException, NotFoundException { 98 99 X509Name sender = X509Name.getInstance(getSender().getName()); 100 X509Name recipient = X509Name.getInstance(getRecipient().getName()); 101 PKIHeader myPKIHeader = CmpMessageHelper.createPKIHeader(sender, recipient, getSenderNonce(), getRecipientNonce(), getTransactionId()); 102 PKIBody myPKIBody = new PKIBody(new DERNull(), 19); 103 PKIMessage myPKIMessage = new PKIMessage(myPKIHeader, myPKIBody); 104 105 if ((getPbeDigestAlg() != null) && (getPbeMacAlg() != null) && (getPbeKeyId() != null) && (getPbeKey() != null) ) { 106 responseMessage = CmpMessageHelper.protectPKIMessageWithPBE(myPKIMessage, getPbeKeyId(), getPbeKey(), getPbeDigestAlg(), getPbeMacAlg(), getPbeIterationCount()); 107 } else { 108 responseMessage = CmpMessageHelper.pkiMessageToByteArray(myPKIMessage); 109 } 110 return true; 111 } 112 113 public boolean requireSignKeyInfo() { 114 return false; 115 } 116 117 public boolean requireEncKeyInfo() { 118 return false; 119 } 120 121 public void setSignKeyInfo(X509Certificate cert, PrivateKey key, 122 String provider) { 123 } 124 125 public void setEncKeyInfo(X509Certificate cert, PrivateKey key, 126 String provider) { 127 } 128 129 public void setSenderNonce(String senderNonce) { 130 super.setSenderNonce(senderNonce); 131 } 132 133 public void setRecipientNonce(String recipientNonce) { 134 super.setRecipientNonce(recipientNonce); 135 } 136 137 public void setTransactionId(String transactionId) { 138 super.setTransactionId(transactionId); 139 } 140 141 public void setRecipientKeyInfo(byte[] recipientKeyInfo) { 142 } 143 144 public void setPreferredDigestAlg(String digest) { 145 } 146 147 public void setRequestType(int reqtype) { 148 } 149 150 public void setRequestId(int reqid) { 151 } 152 153 155 public void setProtectionParamsFromRequest(IRequestMessage reqMsg) { 156 } 157 } 158 | Popular Tags |