using System; using Org.BouncyCastle.Asn1; namespace Org.BouncyCastle.Asn1.X509.Qualified { /** * The TypeOfBiometricData object. * <pre> * TypeOfBiometricData ::= CHOICE { * predefinedBiometricType PredefinedBiometricType, * biometricDataOid OBJECT IDENTIFIER } * * PredefinedBiometricType ::= INTEGER { * picture(0),handwritten-signature(1)} * (picture|handwritten-signature) * </pre> */ public class TypeOfBiometricData : Asn1Encodable { public const int Picture = 0; public const int HandwrittenSignature = 1; internal Asn1Encodable obj; public static TypeOfBiometricData GetInstance( object obj) { if (obj == null || obj is TypeOfBiometricData) { return (TypeOfBiometricData) obj; } if (obj is DerInteger) { DerInteger predefinedBiometricTypeObj = DerInteger.GetInstance(obj); int predefinedBiometricType = predefinedBiometricTypeObj.Value.IntValue; return new TypeOfBiometricData(predefinedBiometricType); } if (obj is DerObjectIdentifier) { DerObjectIdentifier BiometricDataOid = DerObjectIdentifier.GetInstance(obj); return new TypeOfBiometricData(BiometricDataOid); } throw new ArgumentException("unknown object in GetInstance"); } public TypeOfBiometricData( int predefinedBiometricType) { if (predefinedBiometricType == Picture || predefinedBiometricType == HandwrittenSignature) { obj = new DerInteger(predefinedBiometricType); } else { throw new ArgumentException("unknow PredefinedBiometricType : " + predefinedBiometricType); } } public TypeOfBiometricData( DerObjectIdentifier biometricDataOid) { obj = biometricDataOid; } public bool IsPredefined { get { return obj is DerInteger; } } public int PredefinedBiometricType { get { return ((DerInteger) obj).Value.IntValue; } } public DerObjectIdentifier BiometricDataOid { get { return (DerObjectIdentifier) obj; } } public override Asn1Object ToAsn1Object() { return obj.ToAsn1Object(); } } }
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)