if ( !ret ) {
StressTest.this.performanceTest.getLog().error("Can not verify signerInfo");
return false;
}
// Get authenticated attributes
AttributeTable tab = signerInfo.getSignedAttributes();
// --Fail info
Attribute attr = tab.get(new DERObjectIdentifier(ScepRequestMessage.id_failInfo));
// No failInfo on this success message
if(expectedResponseStatus == ResponseStatus.SUCCESS){
if ( attr != null ) {
StressTest.this.performanceTest.getLog().error("Success message should have attr == null");
return false;
}
}
// --Message type
attr = tab.get(new DERObjectIdentifier(ScepRequestMessage.id_messageType));
if ( attr == null ) {
StressTest.this.performanceTest.getLog().error("MessageType should not be null for responseStatus: "+expectedResponseStatus);
return false;
}
ASN1Set values = attr.getAttrValues();
if ( values.size() != 1 ) {
StressTest.this.performanceTest.getLog().error("MessageType.AttrValues should be 1: "+values.size());
return false;
}
DERString str = DERPrintableString.getInstance((values.getObjectAt(0)));
String messageType = str.getString();
if ( !StringUtils.equals(messageType, "3") ) {
StressTest.this.performanceTest.getLog().error("MessageType should be 3: "+messageType);
return false;
}
// --Success status
attr = tab.get(new DERObjectIdentifier(ScepRequestMessage.id_pkiStatus));
if ( attr == null ) {
StressTest.this.performanceTest.getLog().error("PKIStatus should not be null");
return false;
}
values = attr.getAttrValues();
if ( values.size() != 1 ) {
StressTest.this.performanceTest.getLog().error("PKIStatus.AttrValues should be 1: "+values.size());
return false;
}
str = DERPrintableString.getInstance((values.getObjectAt(0)));
String responsestatus = str.getString();
if ( !StringUtils.equals(expectedResponseStatus.getValue(), responsestatus) ) {
StressTest.this.performanceTest.getLog().error("ResponseStatus should be "+expectedResponseStatus.getValue()+" but was: "+responsestatus);
return false;
}
// --SenderNonce
attr = tab.get(new DERObjectIdentifier(ScepRequestMessage.id_senderNonce));
if ( attr == null ) {
StressTest.this.performanceTest.getLog().error("SenderNonce should not be null");
return false;
}
values = attr.getAttrValues();
if ( values.size() != 1 ) {
StressTest.this.performanceTest.getLog().error("SenderNonce.AttrValues should be 1: "+values.size());
return false;
}
ASN1OctetString octstr = ASN1OctetString.getInstance(values.getObjectAt(0));
// SenderNonce is something the server came up with, but it should be 16 chars
if ( octstr.getOctets().length != 16 ) {
StressTest.this.performanceTest.getLog().error("SenderNonce should be 16 bytes: "+octstr.getOctets().length);
return false;
}
// --Recipient Nonce
attr = tab.get(new DERObjectIdentifier(ScepRequestMessage.id_recipientNonce));
if ( attr == null ) {
StressTest.this.performanceTest.getLog().error("RecipientNonce should not be null");
return false;
}
values = attr.getAttrValues();
if ( values.size() != 1 ) {
StressTest.this.performanceTest.getLog().error("RecipientNonce.AttrValues should be 1: "+values.size());
return false;
}
octstr = ASN1OctetString.getInstance(values.getObjectAt(0));
// recipient nonce should be the same as we sent away as sender nonce
String nonce = new String(Base64.encode(octstr.getOctets()));
if ( !StringUtils.equals(senderNonce, nonce) ) {
StressTest.this.performanceTest.getLog().error("RecipientNonce should be "+senderNonce+" but was: "+nonce);
return false;
}
// --Transaction ID
attr = tab.get(new DERObjectIdentifier(ScepRequestMessage.id_transId));
if ( attr == null ) {
StressTest.this.performanceTest.getLog().error("TransId should not be null");
return false;
}
values = attr.getAttrValues();