/// <summary> /// Initializes a new instance of the CkPkcs5Pbkd2Params class. /// </summary> /// <param name='saltSource'>Source of the salt value (CKZ)</param> /// <param name='saltSourceData'>Data used as the input for the salt source</param> /// <param name='iterations'>Number of iterations to perform when generating each block of random data</param> /// <param name='prf'>Pseudo-random function to used to generate the key (CKP)</param> /// <param name='prfData'>Data used as the input for PRF in addition to the salt value</param> /// <param name='password'>Password to be used in the PBE key generation</param> public CkPkcs5Pbkd2Params(ulong saltSource, byte[] saltSourceData, ulong iterations, ulong prf, byte[] prfData, byte[] password) { if (Platform.UnmanagedLongSize == 4) { if (Platform.StructPackingSize == 0) { _params40 = new HighLevelAPI40.MechanismParams.CkPkcs5Pbkd2Params(Convert.ToUInt32(saltSource), saltSourceData, Convert.ToUInt32(iterations), Convert.ToUInt32(prf), prfData, password); } else { _params41 = new HighLevelAPI41.MechanismParams.CkPkcs5Pbkd2Params(Convert.ToUInt32(saltSource), saltSourceData, Convert.ToUInt32(iterations), Convert.ToUInt32(prf), prfData, password); } } else { if (Platform.StructPackingSize == 0) { _params80 = new HighLevelAPI80.MechanismParams.CkPkcs5Pbkd2Params(saltSource, saltSourceData, iterations, prf, prfData, password); } else { _params81 = new HighLevelAPI81.MechanismParams.CkPkcs5Pbkd2Params(saltSource, saltSourceData, iterations, prf, prfData, password); } } }
/// <summary> /// Initializes a new instance of the CkPkcs5Pbkd2Params class. /// </summary> /// <param name='saltSource'>Source of the salt value (CKZ)</param> /// <param name='saltSourceData'>Data used as the input for the salt source</param> /// <param name='iterations'>Number of iterations to perform when generating each block of random data</param> /// <param name='prf'>Pseudo-random function to used to generate the key (CKP)</param> /// <param name='prfData'>Data used as the input for PRF in addition to the salt value</param> /// <param name='password'>Password to be used in the PBE key generation</param> public CkPkcs5Pbkd2Params(ulong saltSource, byte[] saltSourceData, ulong iterations, ulong prf, byte[] prfData, byte[] password) { if (Platform.UnmanagedLongSize == 4) { if (Platform.StructPackingSize == 0) _params40 = new HighLevelAPI40.MechanismParams.CkPkcs5Pbkd2Params(Convert.ToUInt32(saltSource), saltSourceData, Convert.ToUInt32(iterations), Convert.ToUInt32(prf), prfData, password); else _params41 = new HighLevelAPI41.MechanismParams.CkPkcs5Pbkd2Params(Convert.ToUInt32(saltSource), saltSourceData, Convert.ToUInt32(iterations), Convert.ToUInt32(prf), prfData, password); } else { if (Platform.StructPackingSize == 0) _params80 = new HighLevelAPI80.MechanismParams.CkPkcs5Pbkd2Params(saltSource, saltSourceData, iterations, prf, prfData, password); else _params81 = new HighLevelAPI81.MechanismParams.CkPkcs5Pbkd2Params(saltSource, saltSourceData, iterations, prf, prfData, password); } }
/// <summary> /// Disposes object /// </summary> /// <param name="disposing">Flag indicating whether managed resources should be disposed</param> protected virtual void Dispose(bool disposing) { if (!this._disposed) { if (disposing) { // Dispose managed objects if (_params40 != null) { _params40.Dispose(); _params40 = null; } if (_params41 != null) { _params41.Dispose(); _params41 = null; } if (_params80 != null) { _params80.Dispose(); _params80 = null; } if (_params81 != null) { _params81.Dispose(); _params81 = null; } } // Dispose unmanaged objects _disposed = true; } }