private TimeStampedDataParser(Asn1SequenceParser parser) { this.parser = parser; this.version = DerInteger.GetInstance(parser.ReadObject()); Asn1Object obj = parser.ReadObject().ToAsn1Object(); if (obj is DerIA5String) { this.dataUri = DerIA5String.GetInstance(obj); obj = parser.ReadObject().ToAsn1Object(); } if (//obj is MetaData || obj is Asn1SequenceParser) { this.metaData = MetaData.GetInstance(obj.ToAsn1Object()); obj = parser.ReadObject().ToAsn1Object(); } if (obj is Asn1OctetStringParser) { this.content = (Asn1OctetStringParser)obj; } }
/// <inheritdoc /> public override void InjectReferenceValue(X509Certificate2 value) { Certificate = value; Asn1Object exValue = GetExtensionValue(value); if (exValue == null) { if (IsRequired()) { throw new PolicyRequiredException("Extention " + ExtentionIdentifier.Display + " is marked as required by is not present."); } var emptyList = new List <string>(); PolicyValue = new PolicyValue <IList <String> >(emptyList); return; } var retVal = new List <String>(); var seq = exValue.ToAsn1Object() as Asn1Sequence; if (seq != null) { var pols = seq.GetEnumerator(); while (pols.MoveNext()) { PolicyInformation pol = PolicyInformation.GetInstance(pols.Current); retVal.Add(pol.PolicyIdentifier.Id); } } //TODO: PolicyInformation is only storing the ID. There other intersting info items in here that we may want //maybe not for rules but for when things go wrong... logging info. PolicyValue = new PolicyValue <IList <String> >(retVal); }
public DerExternal(DerObjectIdentifier directReference, DerInteger indirectReference, Asn1Object dataValueDescriptor, int encoding, Asn1Object externalData) { DirectReference = directReference; IndirectReference = indirectReference; DataValueDescriptor = dataValueDescriptor; Encoding = encoding; ExternalContent = externalData.ToAsn1Object(); }
/// <inheritdoc /> public override void InjectReferenceValue(X509Certificate2 value) { Certificate = value; Asn1Object exValue = GetExtensionValue(value); if (exValue == null) { if (IsRequired()) { throw new PolicyRequiredException("Extention " + ExtentionIdentifier.Display + " is marked as required by is not present."); } var emptyList = new List <string>(); PolicyValue = new PolicyValue <IList <string> >(emptyList); return; } var retVal = new List <String>(); var seq = exValue.ToAsn1Object() as Asn1Sequence; if (seq != null) { var pols = seq.GetEnumerator(); while (pols.MoveNext()) { PolicyInformation pol = PolicyInformation.GetInstance(pols.Current); if (pol.PolicyQualifiers != null) { var polInfos = pol.PolicyQualifiers.GetEnumerator(); while (polInfos.MoveNext()) { // The PolicyQualifier object is not exposed nicely in the BouncyCastle API where Java is. var derseq = polInfos.Current as DerSequence; if (derseq.Id().Equals(PolicyQualifierID.IdQtCps)) { retVal.Add(derseq.Value()); } } } } } PolicyValue = new PolicyValue <IList <string> >(retVal); }
private TimeStampedDataParser(Asn1SequenceParser parser) { this.parser = parser; version = DerInteger.GetInstance(parser.ReadObject()); Asn1Object asn1Object = parser.ReadObject().ToAsn1Object(); if (asn1Object is DerIA5String) { dataUri = DerIA5String.GetInstance(asn1Object); asn1Object = parser.ReadObject().ToAsn1Object(); } if (asn1Object is Asn1SequenceParser) { metaData = MetaData.GetInstance(asn1Object.ToAsn1Object()); asn1Object = parser.ReadObject().ToAsn1Object(); } if (asn1Object is Asn1OctetStringParser) { content = (Asn1OctetStringParser)asn1Object; } }