using System; namespace Org.BouncyCastle.Asn1.X509 { /** * Target structure used in target information extension for attribute * certificates from RFC 3281. * *
* Target ::= CHOICE {
* targetName [0] GeneralName,
* targetGroup [1] GeneralName,
* targetCert [2] TargetCert
* }
*
*
* * The targetCert field is currently not supported and must not be used * according to RFC 3281.
*/ public class Target : Asn1Encodable //, ASN1Choice { public enum Choice { Name = 0, Group = 1 }; private readonly GeneralName targetName; private readonly GeneralName targetGroup; /** * Creates an instance of a Target from the given object. *
* obj can be a Target or a {@link Asn1TaggedObject}
* Exactly one of the parameters must be not null.
* Target ::= CHOICE {
* targetName [0] GeneralName,
* targetGroup [1] GeneralName,
* targetCert [2] TargetCert
* }
*
*
* @return an Asn1Object
*/
public override Asn1Object ToAsn1Object()
{
// GeneralName is a choice already so most be explicitly tagged
if (targetName != null)
{
return new DerTaggedObject(true, 0, targetName);
}
return new DerTaggedObject(true, 1, targetGroup);
}
}
}