Initial Commit
This commit is contained in:
35
iTechSharp/srcbc/cms/PKCS5Scheme2PBEKey.cs
Normal file
35
iTechSharp/srcbc/cms/PKCS5Scheme2PBEKey.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
|
||||
using Org.BouncyCastle.Crypto;
|
||||
using Org.BouncyCastle.Crypto.Generators;
|
||||
using Org.BouncyCastle.Crypto.Parameters;
|
||||
|
||||
namespace Org.BouncyCastle.Cms
|
||||
{
|
||||
public class Pkcs5Scheme2PbeKey
|
||||
: CmsPbeKey
|
||||
{
|
||||
public Pkcs5Scheme2PbeKey(
|
||||
string password,
|
||||
byte[] salt,
|
||||
int iterationCount)
|
||||
: base(password, salt, iterationCount)
|
||||
{
|
||||
}
|
||||
|
||||
internal override KeyParameter GetEncoded(
|
||||
string algorithmOid)
|
||||
{
|
||||
Pkcs5S2ParametersGenerator gen = new Pkcs5S2ParametersGenerator();
|
||||
|
||||
gen.Init(
|
||||
PbeParametersGenerator.Pkcs5PasswordToBytes(this.Password),
|
||||
this.Salt,
|
||||
this.IterationCount);
|
||||
|
||||
return (KeyParameter) gen.GenerateDerivedParameters(
|
||||
algorithmOid,
|
||||
CmsEnvelopedHelper.Instance.GetKeySize(algorithmOid));
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user