}
public abstract void writeMetaData(Writer writer);
protected void addKeyDescriptorToMetaData(SSODescriptorType ssoDescriptor) {
ObjectFactory metaDataFactory = new ObjectFactory();
org.jboss.seam.security.external.jaxb.xmldsig.ObjectFactory signatureFactory = new org.jboss.seam.security.external.jaxb.xmldsig.ObjectFactory();
X509Certificate certificate = getSigningKey().getCertificate();
if (certificate == null)
throw new RuntimeException("Certificate obtained from configuration is null");
JAXBElement<byte[]> X509Certificate;
try {
X509Certificate = signatureFactory.createX509DataTypeX509Certificate(certificate.getEncoded());
} catch (CertificateEncodingException e) {
throw new RuntimeException(e);
}
X509DataType X509Data = signatureFactory.createX509DataType();
X509Data.getX509IssuerSerialOrX509SKIOrX509SubjectName().add(X509Certificate);
KeyInfoType keyInfo = signatureFactory.createKeyInfoType();
keyInfo.getContent().add(signatureFactory.createX509Data(X509Data));
KeyDescriptorType keyDescriptor = metaDataFactory.createKeyDescriptorType();
keyDescriptor.setUse(KeyTypes.SIGNING);
keyDescriptor.setKeyInfo(keyInfo);
ssoDescriptor.getKeyDescriptor().add(keyDescriptor);
}