KeyInfoConfirmationDataType keyInfoDataType = new KeyInfoConfirmationDataTypeBuilder()
.buildObject();
BasicX509Credential keyInfoCredential = new BasicX509Credential();
keyInfoCredential.setEntityCertificate(certificate);
keyInfoCredential.setPublicKey(certificate.getPublicKey());
BasicKeyInfoGeneratorFactory kiFactory = new BasicKeyInfoGeneratorFactory();
kiFactory.setEmitPublicKeyValue(true);
KeyInfo keyInfo = kiFactory.newInstance().generate(keyInfoCredential);
keyInfoDataType.getKeyInfos().add(keyInfo);
subject.getSubjectConfirmations().add(confirmation);
subject.getSubjectConfirmations().get(0)
.setSubjectConfirmationData(keyInfoDataType);
return subject;