add all
This commit is contained in:
51
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/cms/PKCS5Scheme2UTF8PBEKey.cs
vendored
Normal file
51
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/cms/PKCS5Scheme2UTF8PBEKey.cs
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Crypto;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Crypto.Generators;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Crypto.Parameters;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Cms
|
||||
{
|
||||
/**
|
||||
* PKCS5 scheme-2 - password converted to bytes using UTF-8.
|
||||
*/
|
||||
public class Pkcs5Scheme2Utf8PbeKey
|
||||
: CmsPbeKey
|
||||
{
|
||||
public Pkcs5Scheme2Utf8PbeKey(
|
||||
char[] password,
|
||||
byte[] salt,
|
||||
int iterationCount)
|
||||
: base(password, salt, iterationCount)
|
||||
{
|
||||
}
|
||||
|
||||
public Pkcs5Scheme2Utf8PbeKey(
|
||||
char[] password,
|
||||
AlgorithmIdentifier keyDerivationAlgorithm)
|
||||
: base(password, keyDerivationAlgorithm)
|
||||
{
|
||||
}
|
||||
|
||||
internal override KeyParameter GetEncoded(
|
||||
string algorithmOid)
|
||||
{
|
||||
Pkcs5S2ParametersGenerator gen = new Pkcs5S2ParametersGenerator();
|
||||
|
||||
gen.Init(
|
||||
PbeParametersGenerator.Pkcs5PasswordToUtf8Bytes(password),
|
||||
salt,
|
||||
iterationCount);
|
||||
|
||||
return (KeyParameter) gen.GenerateDerivedParameters(
|
||||
algorithmOid,
|
||||
CmsEnvelopedHelper.Instance.GetKeySize(algorithmOid));
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
Reference in New Issue
Block a user