String valueType = certInfo.getValueType();
if(valueType==MessageConstants.X509v1_NS||valueType.equals(MessageConstants.X509v1_NS)) {
logger.log(Level.SEVERE, LogStringsMessages.WSS_1333_UNSUPPORTED_KEYIDENTIFER_X_509_V_1());
throw new XWSSecurityException("Key Identifier reference Type is not allowed for X509v1 Certificates");
}
KeyIdentifierStrategy keyIdentifier =
new KeyIdentifierStrategy(certInfo.getCertificateIdentifier(),true);
keyIdentifier.setCertificate(certInfo.getX509Certificate());
SecurityTokenReference secTokenRef = new SecurityTokenReference(secureMessage.getSOAPPart());
keyIdentifier.insertKey(secTokenRef, secureMessage);
secTokenRef.setWsuId(strId);
X509SubjectKeyIdentifier re = (X509SubjectKeyIdentifier)secTokenRef.getReference();
String id = re.getReferenceValue();
tokenCache.put(id, re);
re.setCertificate(certInfo.getX509Certificate());
keyInfo = dsigHelper.constructKeyInfo(signaturePolicy,secTokenRef);
nextSibling = securityHeader.getNextSiblingOfTimestamp();
nxtSiblingContainer[0] = nextSibling;
return keyInfo;
}else if(referenceType.equals(MessageConstants.THUMB_PRINT_TYPE)){
String valueType = certInfo.getValueType();
if(valueType==MessageConstants.X509v1_NS||valueType.equals(MessageConstants.X509v1_NS)) {
logger.log(Level.SEVERE,LogStringsMessages.WSS_1348_ILLEGAL_THUMBPRINT_X_509_V_1());
throw new XWSSecurityException("Thumb reference Type is not allowed for X509v1 Certificates");
}
KeyIdentifierStrategy keyIdentifier = new KeyIdentifierStrategy(certInfo.getCertificateIdentifier(),true, true);
keyIdentifier.setCertificate(certInfo.getX509Certificate());
SecurityTokenReference secTokenRef = new SecurityTokenReference(secureMessage.getSOAPPart());
keyIdentifier.insertKey(secTokenRef, secureMessage);
secTokenRef.setWsuId(strId);
X509ThumbPrintIdentifier re = (X509ThumbPrintIdentifier)secTokenRef.getReference();
String id = re.getReferenceValue();
tokenCache.put(id, re);
re.setCertificate(certInfo.getX509Certificate());