本文整理汇总了C#中SymmetricKeyAlgorithmTag类的典型用法代码示例。如果您正苦于以下问题:C# SymmetricKeyAlgorithmTag类的具体用法?C# SymmetricKeyAlgorithmTag怎么用?C# SymmetricKeyAlgorithmTag使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SymmetricKeyAlgorithmTag类属于命名空间,在下文中一共展示了SymmetricKeyAlgorithmTag类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PgpEncryptedDataGenerator
/// <summary>Existing SecureRandom constructor.</summary>
/// <param name="encAlgorithm">The symmetric algorithm to use.</param>
/// <param name="rand">Source of randomness.</param>
public PgpEncryptedDataGenerator(
SymmetricKeyAlgorithmTag encAlgorithm,
SecureRandom rand)
{
this.defAlgorithm = encAlgorithm;
this.rand = rand;
}
示例2: ECDHPublicKeyParameters
/// <summary>
/// Initializes a new instance of the <see cref="ECDHPublicKeyParameters" /> class.
/// </summary>
/// <param name="q">The q.</param>
/// <param name="parameters">The parameters.</param>
/// <param name="hashAlgorithm">The hash algorithm.</param>
/// <param name="symmetricKeyAlgorithm">The symmetric key algorithm.</param>
public ECDHPublicKeyParameters(ECPoint q, ECDomainParameters parameters, HashAlgorithmTag hashAlgorithm,
SymmetricKeyAlgorithmTag symmetricKeyAlgorithm)
: base("ECDH", q, parameters)
{
this.HashAlgorithm = hashAlgorithm;
this.SymmetricKeyAlgorithm = symmetricKeyAlgorithm;
}
示例3: ECKeyGenerationParameters
/// <summary>
/// Initializes a new instance of the <see cref="ECKeyGenerationParameters"/> class.
/// </summary>
/// <param name="publicKeyParamSet">The public key param set.</param>
/// <param name="random">The random.</param>
/// <param name="hashAlgorithm">The hash algorithm.</param>
/// <param name="symmetricKeyAlgorithm">The symmetric key algorithm.</param>
public ECKeyGenerationParameters(DerObjectIdentifier publicKeyParamSet, ISecureRandom random, HashAlgorithmTag hashAlgorithm, SymmetricKeyAlgorithmTag symmetricKeyAlgorithm)
: this(ECKeyParameters.LookupParameters(publicKeyParamSet), random)
{
_publicKeyParamSet = publicKeyParamSet;
_hashAlgorithm = hashAlgorithm;
_symmetricKeyAlgorithm = symmetricKeyAlgorithm;
}
示例4: SymmetricKeyEncSessionPacket
/// <summary>
/// Initializes a new instance of the <see cref="SymmetricKeyEncSessionPacket"/> class.
/// </summary>
/// <param name="encAlgorithm">The enc algorithm.</param>
/// <param name="s2k">The S2K.</param>
/// <param name="secKeyData">The sec key data.</param>
public SymmetricKeyEncSessionPacket(SymmetricKeyAlgorithmTag encAlgorithm, S2k s2k, byte[] secKeyData)
{
this.Version = 4;
this.EncAlgorithm = encAlgorithm;
this.S2K = s2k;
this._secKeyData = secKeyData;
}
示例5: SecretKeyPacket
internal SecretKeyPacket(
BcpgInputStream bcpgIn)
{
pubKeyPacket = new PublicKeyPacket(bcpgIn);
s2kUsage = bcpgIn.ReadByte();
if (s2kUsage == UsageChecksum || s2kUsage == UsageSha1)
{
encAlgorithm = (SymmetricKeyAlgorithmTag) bcpgIn.ReadByte();
s2k = new S2k(bcpgIn);
}
else
{
encAlgorithm = (SymmetricKeyAlgorithmTag) s2kUsage;
}
if (!(s2k != null && s2k.Type == S2k.GnuDummyS2K && s2k.ProtectionMode == 0x01))
{
if (s2kUsage != 0)
{
if (((int) encAlgorithm) < 7)
{
iv = new byte[8];
}
else
{
iv = new byte[16];
}
bcpgIn.ReadFully(iv);
}
}
secKeyData = bcpgIn.ReadAll();
}
示例6: Create
/// <summary>
/// Creates a ECDH public key parameters from the given encoded point.
/// </summary>
/// <param name="encodedPoint">The encoded point.</param>
/// <param name="publicKeyParamSet">The public key param set.</param>
/// <param name="hashAlgorithm">The hash algorithm.</param>
/// <param name="symmetricKeyAlgorithm">The symmetric key algorithm.</param>
/// <returns></returns>
public static ECDHPublicKeyParameters Create(IBigInteger encodedPoint, DerObjectIdentifier publicKeyParamSet,
HashAlgorithmTag hashAlgorithm, SymmetricKeyAlgorithmTag symmetricKeyAlgorithm)
{
var curve = ECKeyPairGenerator.FindECCurveByOid(publicKeyParamSet);
var point = curve.Curve.DecodePoint(encodedPoint.ToByteArrayUnsigned());
return new ECDHPublicKeyParameters(point, publicKeyParamSet, hashAlgorithm, symmetricKeyAlgorithm);
}
示例7: PbeMethod
internal PbeMethod(
SymmetricKeyAlgorithmTag encAlgorithm,
S2k s2k,
KeyParameter key)
{
this.encAlgorithm = encAlgorithm;
this.s2k = s2k;
this.key = key;
}
示例8: SecretSubkeyPacket
public SecretSubkeyPacket(
PublicKeyPacket pubKeyPacket,
SymmetricKeyAlgorithmTag encAlgorithm,
S2k s2k,
byte[] iv,
byte[] secKeyData)
: base(pubKeyPacket, encAlgorithm, s2k, iv, secKeyData)
{
}
示例9: SecretKeyPacket
/// <summary>
/// Initializes a new instance of the <see cref="SecretKeyPacket"/> class.
/// </summary>
/// <param name="pubKeyPacket">The pub key packet.</param>
/// <param name="encAlgorithm">The enc algorithm.</param>
/// <param name="s2KUsage">The s2 K usage.</param>
/// <param name="s2K">The s2 K.</param>
/// <param name="iv">The iv.</param>
/// <param name="secKeyData">The sec key data.</param>
public SecretKeyPacket(IPublicKeyPacket pubKeyPacket, SymmetricKeyAlgorithmTag encAlgorithm, int s2KUsage, S2k s2K, byte[] iv, byte[] secKeyData)
{
this.PublicKeyPacket = pubKeyPacket;
this.EncAlgorithm = encAlgorithm;
this.S2KUsage = s2KUsage;
this.S2K = s2K;
_iv = Arrays.Clone(iv);
_secKeyData = secKeyData;
}
示例10: PgpSecretKey
internal PgpSecretKey(
PgpPrivateKey privKey,
PgpPublicKey pubKey,
SymmetricKeyAlgorithmTag encAlgorithm,
char[] passPhrase,
bool useSha1,
SecureRandom rand)
: this(privKey, pubKey, encAlgorithm, passPhrase, useSha1, rand, false)
{
}
示例11: SymmetricKeyEncSessionPacket
public SymmetricKeyEncSessionPacket(
BcpgInputStream bcpgIn)
{
version = bcpgIn.ReadByte();
encAlgorithm = (SymmetricKeyAlgorithmTag) bcpgIn.ReadByte();
s2k = new S2k(bcpgIn);
secKeyData = bcpgIn.ReadAll();
}
示例12: ECDHPublicBcpgKey
/// <summary>
/// Initializes a new instance of the <see cref="ECDHPublicBcpgKey"/> class.
/// </summary>
/// <param name="point">The point.</param>
/// <param name="oid">The oid.</param>
/// <param name="hashAlgorithm">The hash algorithm.</param>
/// <param name="symmetricKeyAlgorithm">The symmetric key algorithm.</param>
public ECDHPublicBcpgKey(ECPoint point, DerObjectIdentifier oid, HashAlgorithmTag hashAlgorithm,
SymmetricKeyAlgorithmTag symmetricKeyAlgorithm)
: base(point, oid)
{
_reserved = 1;
_hashFunctionId = (byte)hashAlgorithm;
_symAlgorithmId = (byte)symmetricKeyAlgorithm;
this.VerifyHashAlgorithm();
this.VerifySymmetricKeyAlgorithm();
}
示例13: PgpSecretKey
public PgpSecretKey(
int certificationLevel,
PgpKeyPair keyPair,
string id,
SymmetricKeyAlgorithmTag encAlgorithm,
char[] passPhrase,
PgpSignatureSubpacketVector hashedPackets,
PgpSignatureSubpacketVector unhashedPackets,
ISecureRandom rand)
: this(certificationLevel, keyPair, id, encAlgorithm, passPhrase, false, hashedPackets, unhashedPackets, rand)
{
}
示例14: PgpKeyRingGenerator
/// <summary>
/// Create a new key ring generator using old style checksumming. It is recommended to use
/// SHA1 checksumming where possible.
/// </summary>
/// <param name="certificationLevel">The certification level for keys on this ring.</param>
/// <param name="masterKey">The master key pair.</param>
/// <param name="id">The id to be associated with the ring.</param>
/// <param name="encAlgorithm">The algorithm to be used to protect secret keys.</param>
/// <param name="passPhrase">The passPhrase to be used to protect secret keys.</param>
/// <param name="hashedPackets">Packets to be included in the certification hash.</param>
/// <param name="unhashedPackets">Packets to be attached unhashed to the certification.</param>
/// <param name="rand">input secured random.</param>
public PgpKeyRingGenerator(
int certificationLevel,
PgpKeyPair masterKey,
string id,
SymmetricKeyAlgorithmTag encAlgorithm,
char[] passPhrase,
PgpSignatureSubpacketVector hashedPackets,
PgpSignatureSubpacketVector unhashedPackets,
SecureRandom rand)
: this(certificationLevel, masterKey, id, encAlgorithm, passPhrase, false, hashedPackets, unhashedPackets, rand)
{
}
示例15: GetKeyEncryptionOID
public static DerObjectIdentifier GetKeyEncryptionOID(SymmetricKeyAlgorithmTag algID)
{
switch (algID)
{
case SymmetricKeyAlgorithmTag.Aes128:
return NistObjectIdentifiers.IdAes128Wrap;
case SymmetricKeyAlgorithmTag.Aes192:
return NistObjectIdentifiers.IdAes192Wrap;
case SymmetricKeyAlgorithmTag.Aes256:
return NistObjectIdentifiers.IdAes256Wrap;
default:
throw new PgpException("unknown symmetric algorithm ID: " + algID);
}
}