Beispiel #1
0
        public override string ToString()
        {
            var result = new StringBuilder();

            result.AppendLine("I2PCertificate");
            result.AppendLine("CType            : " + CType.ToString());
            result.AppendLine("SignatureType    : " + SignatureType.ToString());

            if (Payload != null)
            {
                result.AppendLine("Payload          : " + Payload.Length + " bytes");
            }
            else
            {
                result.AppendLine("Payload          : (null)");
            }

            if (PayloadLength >= 4)
            {
                result.AppendLine("KEYSignatureType : " + KEYSignatureType.ToString());
                result.AppendLine("KEYPublicKeyType : " + KEYPublicKeyType.ToString());
            }

            return(result.ToString());
        }
Beispiel #2
0
        /// <summary>
        /// Returns a string representation of the packet. This is
        /// a human readable formated representation that has nothing
        /// to do with OpenPGP or RFC2440
        /// </summary>
        /// <returns>String representation of the packet.</returns>
        /// <remarks>No remarks</remarks>
        public override string ToString()
        {
            string strReturn = "";

            strReturn += "Signature Packet:\r\n";
            strReturn += "Version: " + Version.ToString() + "\r\n";
            strReturn += "Signaturetype: " + SignatureType.ToString() + "\r\n";
            strReturn += "Signaturealgorithm: " + SignatureAlgorithm.ToString() + "\r\n";
            strReturn += "Hashalgorithm: " + HashAlgorithm.ToString() + "\r\n";
            strReturn += "Time Created: " + TimeCreated.ToLocalTime() + "\r\n";
            strReturn += "KeyID: " + KeyID + "\r\n";
            strReturn += "Hashed Subpackets: " + HashedSubPackets.Length + "\r\n";

            for (int i = 0; i < HashedSubPackets.Length; i++)
            {
                strReturn += HashedSubPackets[i].ToString() + "\r\n";
            }

            strReturn += "\r\nUnhashed Subpackets: " + UnhashedSubPackets.Length + "\r\n";
            for (int i = 0; i < UnhashedSubPackets.Length; i++)
            {
                strReturn += UnhashedSubPackets[i].ToString() + "\r\n";
            }

            strReturn += "Key Material:\r\n";

            for (int i = 0; i < Signature.Length; i++)
            {
                strReturn += Signature[i].ToString(16) + "\r\n\r\n";
            }

            return(strReturn + "----\r\n\r\n");
        }
 public string GetPatientSignature(string patientId, ConsentType consentType, SignatureType signatureType)
 {
     System.Configuration.Configuration config = WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath);
     var conStr = config.AppSettings.Settings["DBConnection"].Value;
     using (var sqlConnection = new SqlConnection(conStr))
     {
         sqlConnection.Open();
         var cmdSignature = new SqlCommand(@"GetPatientSignature", sqlConnection) { CommandType = CommandType.StoredProcedure };
         cmdSignature.Parameters.Add("@patientID", SqlDbType.NVarChar).Value = patientId;
         cmdSignature.Parameters.Add("@signatureType", SqlDbType.VarChar).Value = signatureType.ToString();
         cmdSignature.Parameters.Add("@consentType", SqlDbType.VarChar).Value = consentType.ToString();
         using (var sqlDataAdapter = new SqlDataAdapter(cmdSignature))
         {
             var sig = new DataSet();
             sqlDataAdapter.Fill(sig);
             if (sig.Tables.Count > 0 && sig.Tables[0].Rows.Count > 0 && sig.Tables[0].Rows[0][0] != null)
                 return sig.Tables[0].Rows[0][0].ToString();
         }
     }
     return string.Empty;
 }
 Contracts.Enums.FileType ConvertFileType(SignatureType fileType)
 => Enum.TryParse <Contracts.Enums.FileType>(fileType.ToString(), true, out var result)
     ? result
     : Contracts.Enums.FileType.Unknown;