本文整理汇总了C#中Mono.Math.BigInteger.ToDisplayString方法的典型用法代码示例。如果您正苦于以下问题:C# BigInteger.ToDisplayString方法的具体用法?C# BigInteger.ToDisplayString怎么用?C# BigInteger.ToDisplayString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.Math.BigInteger
的用法示例。
在下文中一共展示了BigInteger.ToDisplayString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: btnCalculateCertificateInformation_Click
private void btnCalculateCertificateInformation_Click(object sender, EventArgs e)
{
try
{
// Get moduli ahead of time since they'll be needed in a chained fashion
byte[] amazonModulusBytes = txtAmazonModulus.Text.FromWireshark();
BigInteger amazonModulus = new BigInteger(amazonModulusBytes);
txtAmazonModulusBase10.Text = amazonModulus.ToDisplayString();
byte[] amazonPublicExponentBytes = txtAmazonPublicExponent.Text.FromWireshark();
byte[] verisignClass3SecureServerModulusBytes = txtVerisignClass3SecureServerModulus.Text.FromWireshark();
BigInteger verisignClass3SecureServerModulus = new BigInteger(verisignClass3SecureServerModulusBytes);
txtVerisignClass3SecureServerModulusBase10.Text = verisignClass3SecureServerModulus.ToDisplayString();
byte[] verisignClass3SecureServerPublicExponentBytes = txtVerisignClass3SecureServerPublicExponent.Text.FromWireshark();
byte[] verisignClass3PrimaryCertificationAuthorityModulusBytes = txtVerisignClass3PrimaryCertificationAuthorityModulus.Text.FromWireshark();
BigInteger verisignClass3PrimaryCertificationAuthorityModulus = new BigInteger(verisignClass3PrimaryCertificationAuthorityModulusBytes);
txtVerisignClass3PrimaryCertificationAuthorityModulusBase10.Text = verisignClass3PrimaryCertificationAuthorityModulus.ToDisplayString();
byte[] verisignClass3PrimaryCertificationAuthorityPublicExponentBytes = txtVerisignClass3PrimaryCertificationAuthorityPublicExponent.Text.FromWireshark();
byte[] amazonSignedCertificateBytes = txtAmazonSignatureValue.Text.FromWireshark();
byte[] amazonDecryptedSignatureBytes = RsaUtilities.GetSignedOriginalValue(amazonSignedCertificateBytes, verisignClass3SecureServerPublicExponentBytes, verisignClass3SecureServerModulusBytes);
txtAmazonDecryptedSignature.Text = amazonDecryptedSignatureBytes.ToDisplayByteString(16);
const int sha1HashSize = 20; // bytes
byte[] amazonHashValueBytes = amazonDecryptedSignatureBytes.SubBytes(amazonDecryptedSignatureBytes.Length - sha1HashSize);
Debug.Assert(ByteUtilities.AreEqual(Hasher.ComputeSHA1Hash(txtAmazonSignedCertificate.Text.FromWireshark()), amazonHashValueBytes));
txtAmazonHashValue.Text = amazonHashValueBytes.ToDisplayByteString();
// For algorithm info, see http://tools.ietf.org/html/rfc3447#page-43
const int algorithmIdSize = 15; // bytes
byte[] amazonAlgorithmIdBytes = amazonDecryptedSignatureBytes.SubBytes(amazonDecryptedSignatureBytes.Length - sha1HashSize - algorithmIdSize, algorithmIdSize);
txtAmazonHashAlgorithmId.Text = amazonAlgorithmIdBytes.ToDisplayByteString();
byte[] verisignClass3SecureServerSignatureValueBytes = txtVerisignClass3SecureServerSignatureValue.Text.FromWireshark();
byte[] verisignClass3SecureServerDecryptedSignatureBytes = RsaUtilities.GetSignedOriginalValue(verisignClass3SecureServerSignatureValueBytes, verisignClass3PrimaryCertificationAuthorityPublicExponentBytes, verisignClass3PrimaryCertificationAuthorityModulusBytes);
txtVerisignClass3SecureServerDecryptedSignature.Text = verisignClass3SecureServerDecryptedSignatureBytes.ToDisplayByteString(16);
byte[] verisignClass3SecureServerHashValueBytes = verisignClass3SecureServerDecryptedSignatureBytes.SubBytes(verisignClass3SecureServerDecryptedSignatureBytes.Length - sha1HashSize);
Debug.Assert(ByteUtilities.AreEqual(Hasher.ComputeSHA1Hash(txtVersignClass3SecureServerSignedCertificate.Text.FromWireshark()), verisignClass3SecureServerHashValueBytes));
txtVerisignClass3SecureServerHashValue.Text = verisignClass3SecureServerHashValueBytes.ToDisplayByteString();
byte[] verisignClass3SecureServerAlgorithmIdBytes = verisignClass3SecureServerDecryptedSignatureBytes.SubBytes(verisignClass3SecureServerDecryptedSignatureBytes.Length - sha1HashSize - algorithmIdSize, algorithmIdSize);
txtVerisignClass3SecureServerHashAlgorithmId.Text = verisignClass3SecureServerAlgorithmIdBytes.ToDisplayByteString();
byte[] verisignClass3PrimaryCertificationAuthoritySignatureValueBytes = txtVerisignClass3PrimaryCertificationAuthoritySignatureValue.Text.FromWireshark();
byte[] verisignClass3PrimaryCertificationAuthorityDecryptedSignatureBytes = RsaUtilities.GetSignedOriginalValue(verisignClass3PrimaryCertificationAuthoritySignatureValueBytes, verisignClass3PrimaryCertificationAuthorityPublicExponentBytes, verisignClass3PrimaryCertificationAuthorityModulusBytes);
txtVerisignClass3PrimaryCertificationAuthorityDecryptedSignature.Text = verisignClass3PrimaryCertificationAuthorityDecryptedSignatureBytes.ToDisplayByteString(16);
const int md2HashSize = 16; // bytes
int md2AlgorithmIdSize = algorithmIdSize + 3;
byte[] verisignClass3PrimaryCertificationAuthorityHashValueBytes = verisignClass3SecureServerDecryptedSignatureBytes.SubBytes(verisignClass3SecureServerDecryptedSignatureBytes.Length - md2HashSize);
txtVerisignClass3PrimaryCertificationAuthorityHashValue.Text = verisignClass3PrimaryCertificationAuthorityHashValueBytes.ToDisplayByteString();
byte[] verisignClass3PrimaryCertificationAuthorityAlgorithmIdBytes = verisignClass3PrimaryCertificationAuthorityDecryptedSignatureBytes.SubBytes(verisignClass3PrimaryCertificationAuthorityDecryptedSignatureBytes.Length - md2HashSize - md2AlgorithmIdSize, md2AlgorithmIdSize);
txtVerisignClass3PrimaryCertificationAuthorityHashAlgorithmId.Text = verisignClass3PrimaryCertificationAuthorityAlgorithmIdBytes.ToDisplayByteString();
}
catch (Exception ex)
{
MessageBox.Show("Error: " + ex.Message);
}
}