本文整理汇总了C#中IAsymmetricBlockCipher类的典型用法代码示例。如果您正苦于以下问题:C# IAsymmetricBlockCipher类的具体用法?C# IAsymmetricBlockCipher怎么用?C# IAsymmetricBlockCipher使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IAsymmetricBlockCipher类属于命名空间,在下文中一共展示了IAsymmetricBlockCipher类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenericSigner
public GenericSigner(
IAsymmetricBlockCipher engine,
IDigest digest)
{
this.engine = engine;
this.digest = digest;
}
示例2: Iso9796d2PssSigner
/// <summary>
/// Generate a signer for the with either implicit or explicit trailers
/// for ISO9796-2, scheme 2 or 3.
/// </summary>
/// <param name="cipher">base cipher to use for signature creation/verification</param>
/// <param name="digest">digest to use.</param>
/// <param name="saltLength">length of salt in bytes.</param>
/// <param name="isImplicit">whether or not the trailer is implicit or gives the hash.</param>
public Iso9796d2PssSigner(
IAsymmetricBlockCipher cipher,
IDigest digest,
int saltLength,
bool isImplicit)
{
this.cipher = cipher;
this.digest = digest;
this.hLen = digest.GetDigestSize();
this.saltLength = saltLength;
if (isImplicit)
{
trailer = TrailerImplicit;
}
else
{
if (digest is Sha1Digest)
{
trailer = TrailerSha1;
}
else if (digest is RipeMD160Digest)
{
trailer = TrailerRipeMD160;
}
else if (digest is RipeMD128Digest)
{
trailer = TrailerRipeMD128;
}
else
{
throw new ArgumentException("no valid trailer for digest");
}
}
}
示例3: OaepEncoding
public OaepEncoding(
IAsymmetricBlockCipher cipher,
IDigest hash,
byte[] encodingParams)
: this(cipher, hash, hash, encodingParams)
{
}
示例4: Iso9796d2Signer
/// <summary>
/// Generate a signer for the with either implicit or explicit trailers
/// for ISO9796-2.
/// </summary>
/// <param name="cipher">base cipher to use for signature creation/verification</param>
/// <param name="digest">digest to use.</param>
/// <param name="isImplicit">whether or not the trailer is implicit or gives the hash.</param>
public Iso9796d2Signer(
IAsymmetricBlockCipher cipher,
IDigest digest,
bool isImplicit)
{
this.cipher = cipher;
this.digest = digest;
if (isImplicit)
{
trailer = TrailerImplicit;
}
else
{
if (digest is Sha1Digest)
{
trailer = TrailerSha1;
}
else if (digest is RipeMD160Digest)
{
trailer = TrailerRipeMD160;
}
else if (digest is RipeMD128Digest)
{
trailer = TrailerRipeMD128;
}
else
{
throw new System.ArgumentException("no valid trailer for digest");
}
}
}
示例5: PssSigner
/// <summary>Basic constructor</summary>
/// <param name="cipher">the asymmetric cipher to use.</param>
/// <param name="digest">the digest to use.</param>
/// <param name="salt">the fixed salt to be used.</param>
public PssSigner(
IAsymmetricBlockCipher cipher,
IDigest digest,
byte[] salt)
: this(cipher, digest, digest, digest, salt.Length, salt, TrailerImplicit)
{
}
示例6: Iso9796d2Signer
/// <summary>
/// Generate a signer for the with either implicit or explicit trailers
/// for ISO9796-2.
/// </summary>
/// <param name="cipher">base cipher to use for signature creation/verification</param>
/// <param name="digest">digest to use.</param>
/// <param name="isImplicit">whether or not the trailer is implicit or gives the hash.</param>
public Iso9796d2Signer(
IAsymmetricBlockCipher cipher,
IDigest digest,
bool isImplicit)
{
this.cipher = cipher;
this.digest = digest;
if (isImplicit)
{
trailer = TrailerImplicit;
}
else
{
string digestName = digest.AlgorithmName;
if (trailerMap.Contains(digestName))
{
trailer = (int)trailerMap[digest.AlgorithmName];
}
else
{
throw new System.ArgumentException("no valid trailer for digest");
}
}
}
示例7: Pkcs1Encoding
/**
* Constructor for decryption with a fixed plaintext length and a fallback
* value that is returned, if the padding is incorrect.
*
* @param cipher
* The cipher to use for cryptographic operation.
* @param fallback
* The fallback value, we don't to a arraycopy here.
*/
public Pkcs1Encoding(IAsymmetricBlockCipher cipher, byte[] fallback)
{
this.engine = cipher;
this.useStrictLength = StrictLengthEnabled;
this.fallback = fallback;
this.pLen = fallback.Length;
}
示例8: PssSigner
/// <summary>Basic constructor</summary>
/// <param name="cipher">the asymmetric cipher to use.</param>
/// <param name="digest">the digest to use.</param>
/// <param name="saltLen">the length of the salt to use (in bytes).</param>
public PssSigner(
IAsymmetricBlockCipher cipher,
IDigest digest,
int saltLen)
: this(cipher, digest, saltLen, TrailerImplicit)
{
}
示例9: AsymmetricStream
/// <summary>
/// Initializes a new instance of the <see cref="AsymmetricStream"/> class.
/// </summary>
/// <param name="cipher">The cipher.</param>
/// <param name="output">The output.</param>
/// <param name="initFunc">The init func.</param>
/// <param name="encrypt">if set to <c>true</c> [encrypt].</param>
public AsymmetricStream(IAsymmetricBlockCipher cipher, Stream output, Action<IBufferedCipher, bool> initFunc,
bool encrypt)
{
_cipher = new BufferedAsymmetricBlockCipher(cipher);
_output = output;
_initFunc = initFunc;
_encrypt = encrypt;
}
示例10: CreateRawSigner
public static PssSigner CreateRawSigner(
IAsymmetricBlockCipher cipher,
IDigest contentDigest,
IDigest mgfDigest,
int saltLen,
byte trailer)
{
return new PssSigner(cipher, new NullDigest(), contentDigest, mgfDigest, saltLen, trailer);
}
示例11: PssSigner
public PssSigner(
IAsymmetricBlockCipher cipher,
IDigest contentDigest,
IDigest mgfDigest,
int saltLen,
byte trailer)
: this(cipher, contentDigest, contentDigest, mgfDigest, saltLen, trailer)
{
}
示例12: PssSigner
private PssSigner(IAsymmetricBlockCipher cipher, IDigest contentDigest1, IDigest contentDigest2, IDigest mgfDigest, int saltLen, byte trailer)
{
_cipher = cipher;
_contentDigest1 = contentDigest1;
_contentDigest2 = contentDigest2;
_mgfDigest = mgfDigest;
_hLen = contentDigest2.GetDigestSize();
_mgfhLen = mgfDigest.GetDigestSize();
_sLen = saltLen;
_salt = new byte[saltLen];
_mDash = new byte[8 + saltLen + _hLen];
_trailer = trailer;
}
示例13: PssSigner
public PssSigner(
IAsymmetricBlockCipher cipher,
IDigest digest,
int saltLen,
byte trailer)
{
this.cipher = cipher;
this.digest = digest;
this.hLen = digest.GetDigestSize();
this.sLen = saltLen;
this.salt = new byte[saltLen];
this.mDash = new byte[8 + saltLen + hLen];
this.trailer = trailer;
}
示例14: OaepEncoding
public OaepEncoding(IAsymmetricBlockCipher cipher, IDigest hash, IDigest mgf1Hash, byte[] encodingParams)
{
_engine = cipher;
_hash = hash;
_mgf1Hash = mgf1Hash;
_defHash = new byte[hash.GetDigestSize()];
if (encodingParams != null)
{
hash.BlockUpdate(encodingParams, 0, encodingParams.Length);
}
hash.DoFinal(_defHash, 0);
}
示例15: X931Signer
/**
* Generate a signer with either implicit or explicit trailers for X9.31.
*
* @param cipher base cipher to use for signature creation/verification
* @param digest digest to use.
* @param implicit whether or not the trailer is implicit or gives the hash.
*/
public X931Signer(IAsymmetricBlockCipher cipher, IDigest digest, bool isImplicit)
{
this.cipher = cipher;
this.digest = digest;
if (isImplicit)
{
trailer = IsoTrailers.TRAILER_IMPLICIT;
}
else if (IsoTrailers.NoTrailerAvailable(digest))
{
throw new ArgumentException("no valid trailer", "digest");
}
else
{
trailer = IsoTrailers.GetTrailer(digest);
}
}