public static void Main() { byte[] validityDataBytes = new byte[] { 0x30, 0x1E, 0x17, 0x0D, 0x31, 0x32, 0x30, 0x34, 0x32, 0x37, 0x31, 0x30, 0x33, 0x31, 0x31, 0x38, 0x5A, 0x17, 0x0D, 0x32, 0x32, 0x30, 0x34, 0x32, 0x35, 0x31, 0x30, 0x33, 0x31, 0x31, 0x38, 0x5A }; Storage.Put(Storage.CurrentContext, "Validity Data Encoded", validityDataBytes); Asn1Data asn1Data = Asn1Parser.ParseFromRawData(validityDataBytes); bool isMovedNext = Asn1Parser.MoveNext(asn1Data); if (isMovedNext) { byte[] notBeforeByte = Asn1Utils.DecodeDateTime(asn1Data); Storage.Put(Storage.CurrentContext, "notBefore", notBeforeByte); isMovedNext = Asn1Parser.MoveNext(asn1Data); if (isMovedNext) { byte [] notAfterByte = Asn1Utils.DecodeDateTime(asn1Data); Storage.Put(Storage.CurrentContext, "notAfter", notAfterByte); } else { Logger.writeLog("ERROR-Can not move to EndDate"); } } else { Logger.writeLog("ERROR-Can not move to StartDate"); } }
public static void Main() { byte[] dataBytes = new byte[] { 0x30, 0x1E, 0x17, 0x0D, 0x31, 0x32, 0x30, 0x34, 0x32, 0x37, 0x31, 0x30, 0x33, 0x31, 0x31, 0x38, 0x5A, 0x17, 0x0D, 0x32, 0x32, 0x30, 0x34, 0x32, 0x35, 0x31, 0x30, 0x33, 0x31, 0x31, 0x38, 0x5A }; Asn1Logger.LogByteArray("Input Byte Array: ", dataBytes); Asn1Data asn1Data = Asn1Parser.ParseFromRawData(dataBytes); bool isMovedNext = Asn1Parser.MoveNext(asn1Data); if (isMovedNext) { byte[] notBeforeByte = Asn1Utils.DecodeDateTime(asn1Data); Asn1Logger.LogByteArray("Validity-NotBefore: ", notBeforeByte); isMovedNext = Asn1Parser.MoveNext(asn1Data); if (isMovedNext) { byte[] notAfterByte = Asn1Utils.DecodeDateTime(asn1Data); Asn1Logger.LogByteArray("Validity-NotAfter: ", notAfterByte); } else { Logger.writeLog("ERROR-Can not move to EndDate"); } } else { Logger.writeLog("ERROR-Can not move to StartDate"); } }
public static void Main() { byte[] dataBytes = new byte[] { 0x30, 0x1E, 0x17, 0x0D, 0x31, 0x32, 0x30, 0x34, 0x32, 0x37, 0x31, 0x30, 0x33, 0x31, 0x31, 0x38, 0x5A, 0x17, 0x0D, 0x32, 0x32, 0x30, 0x34, 0x32, 0x35, 0x31, 0x30, 0x33, 0x31, 0x31, 0x38, 0x5A }; Asn1Data asn1Data = Asn1Parser.ParseFromRawData(dataBytes); Asn1Logger.LogCurrentNodeValues(asn1Data, "Validity"); bool isMovedNext = Asn1Parser.MoveNext(asn1Data); if (isMovedNext) { byte[] notBeforeByte = Asn1Utils.DecodeDateTime(asn1Data); Asn1Logger.LogCurrentNodeValues(asn1Data, "StartDate"); isMovedNext = Asn1Parser.MoveNext(asn1Data); if (isMovedNext) { Asn1Logger.LogCurrentNodeValues(asn1Data, "EndDate"); } else { Logger.writeLog("ERROR-Can not move to EndDate"); } } else { Logger.writeLog("ERROR-Can not move to StartDate"); } }
void getSigningTime() { var timeAttr = signedCms.SignerInfos[0].AuthenticatedAttributes[SIGNING_TIME]; if (timeAttr != null) { GenerationTimestamp = Asn1Utils.DecodeDateTime(timeAttr.RawData); } }
/// <summary> /// Gets the date and time when the next CRL is planned to be published. The method uses either <strong>Next CRL Publish</strong> extension /// or <strong>NextUpdate</strong> field to determine when a newer version should be issued. /// </summary> /// <returns>A <see cref="DateTime"/> object, or <strong>NULL</strong>, if CRL is valid infinitely and no updates are expected.</returns> public DateTime?GetNextPublish() { if (_extensions == null) { return(NextUpdate); } X509Extension e = _extensions[X509ExtensionOid.NextCRLPublish]; return(e == null ? NextUpdate : Asn1Utils.DecodeDateTime(e.RawData)); }
/// <summary> /// Gets the date and time when the next CRL is planned to be published. The method uses either <strong>Next CRL Publish</strong> extension /// or <strong>NextUpdate</strong> field to determine when a newer version should be issued. /// </summary> /// <returns>A <see cref="DateTime"/> object, or <strong>NULL</strong>, if CRL is valid infinitly and no updates are expected.</returns> /// <exception cref="UninitializedObjectException">An object is not initialized.</exception> public DateTime?GetNextPublish() { if (RawData == null) { throw new UninitializedObjectException(); } if (Extensions == null) { return(NextUpdate); } X509Extension e = Extensions[X509CertExtensions.X509NextCRLPublish]; return(e == null ? NextUpdate : Asn1Utils.DecodeDateTime(e.RawData)); }
void decodeValidity(Asn1Reader asn) { ThisUpdate = Asn1Utils.DecodeDateTime(asn.GetTagRawData()); Int32 offset = asn.Offset; asn.MoveNext(); if (asn.Tag == (Byte)Asn1Type.UTCTime || asn.Tag == (Byte)Asn1Type.GeneralizedTime) { NextUpdate = Asn1Utils.DecodeDateTime(asn.GetTagRawData()); } else { asn.MoveToPosition(offset); } //asn.MoveToPosition(offset); }
void initializeFromRawData(Byte[] rawData) { NextCRLPublish = Asn1Utils.DecodeDateTime(rawData).ToLocalTime(); RawData = rawData; }