本文整理匯總了C#中Org.BouncyCastle.Math.EC.ECPoint.GetEncoded方法的典型用法代碼示例。如果您正苦於以下問題:C# ECPoint.GetEncoded方法的具體用法?C# ECPoint.GetEncoded怎麽用?C# ECPoint.GetEncoded使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Org.BouncyCastle.Math.EC.ECPoint
的用法示例。
在下文中一共展示了ECPoint.GetEncoded方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: PublicKey
public PublicKey(ECPoint point)
{
this.IsCompressedPoint = point.IsCompressed;
this.point = point;
this.PublicKeyBytes = point.GetEncoded();
if (validatePoint() == false) throw new ArgumentException("Not a valid public key");
}
示例2: ECPublicBcpgKey
protected ECPublicBcpgKey(
DerObjectIdentifier oid,
ECPoint point)
{
this.point = new BigInteger(1, point.GetEncoded());
this.oid = oid;
}
示例3: X9ECPoint
public X9ECPoint(ECPoint p, bool compressed)
{
this.p = p.Normalize();
this.encoding = new DerOctetString(p.GetEncoded(compressed));
}
示例4: ImplTestEncoding
/**
* Test encoding with and without point compression.
*
* @param p
* The point to be encoded and decoded.
*/
private void ImplTestEncoding(ECPoint p)
{
// Not Point Compression
byte[] unCompBarr = p.GetEncoded(false);
ECPoint decUnComp = p.Curve.DecodePoint(unCompBarr);
AssertPointsEqual("Error decoding uncompressed point", p, decUnComp);
// Point compression
byte[] compBarr = p.GetEncoded(true);
ECPoint decComp = p.Curve.DecodePoint(compBarr);
AssertPointsEqual("Error decoding compressed point", p, decComp);
}
示例5: ExternalizeKey
static byte[] ExternalizeKey (ECPoint q)
{
// TODO Add support for compressed encoding and SPF extension
/*
* RFC 4492 5.7. ...an elliptic curve point in uncompressed or compressed format.
* Here, the format MUST conform to what the server has requested through a
* Supported Point Formats Extension if this extension was used, and MUST be
* uncompressed if this extension was not used.
*/
return q.GetEncoded ();
}
示例6: K256VerifyingKey
public K256VerifyingKey(ECPoint pub)
{
PubKey = pub;
PubKeyBytes = pub.GetEncoded(true);
SetVerifier(pub);
}
示例7: SerializeECPoint
public static byte[] SerializeECPoint(byte[] ecPointFormats, ECPoint point)
{
ECCurve curve = point.Curve;
/*
* RFC 4492 5.7. ...an elliptic curve point in uncompressed or compressed format. Here, the
* format MUST conform to what the server has requested through a Supported Point Formats
* Extension if this extension was used, and MUST be uncompressed if this extension was not
* used.
*/
bool compressed = false;
if (ECAlgorithms.IsFpCurve(curve))
{
compressed = IsCompressionPreferred(ecPointFormats, ECPointFormat.ansiX962_compressed_prime);
}
else if (ECAlgorithms.IsF2mCurve(curve))
{
compressed = IsCompressionPreferred(ecPointFormats, ECPointFormat.ansiX962_compressed_char2);
}
return point.GetEncoded(compressed);
}