Discuss this help topic in SecureBlackbox Forum

XML: Set signer role

Signer role specifies the position of the signer within a company or an organization. There exist two different ways to add it: using a claimed role name and using an attribute certificate containing a certified role.

To add Claimed Role as text, you need to add xipSignerRole or xipSignerRoleV2 flag into TElXAdESSigner.Included property, then add the text into XAdESSigner.SignerRole.ClaimedRoles as shown in the sample below:

C#:


XAdESSigner.Included = SBXMLAdES.__Global.xipSignerRole;
XAdESSigner.SignerRole.ClaimedRoles.AddText(XAdESSigner.XAdESVersion, XMLDocument, "Role text");
Delphi:

XAdESSigner.Included := [xipSignerRole];
XAdESSigner.SignerRole.ClaimedRoles.AddText(XAdESSigner.XAdESVersion, XMLDocument, 'Role text');

Note: for XAdES-E you need to use SignerRoleV2 property and xipSignerRoleV2 flag in the above code sample.

The sample code below adds Attribute Certificate into CertifiedRoles element:

C#:


TElXMLEncapsulatedPKIData PKIData = new TElXMLEncapsulatedPKIData(XAdESSigner.XAdESVersion);
PKIData.Encoding = SBXMLAdES.__Global.xemDER;
PKIData.Data = File.ReadAllBytes(AttributeCertificateFileName);
XAdESSigner.SignerRole.CertifiedRoles.Add(PKIData);
Delphi:

PKIData := TElXMLEncapsulatedPKIData.Create(XAdESSigner.XAdESVersion);
PKIData.Encoding := xemDER;
PKIData.Data := ReadBytesFromFile(AttributeCertificateFileName);
XAdESSigner.SignerRole.CertifiedRoles.Add(PKIData);

How To articles about XML signing (XMLDSig and XAdES)

Discuss this help topic in SecureBlackbox Forum