IGLib  1.7.2
The IGLib base library for development of numerical, technical and business applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
IG.Crypto.CryptoManager Class Reference

Performs high level cryptographic opereratins, such ass reading command-line parameters and performing high-level tasks that can be directly used in application commands (i.e. those commands that are installed on applicaition interpreters). More...

+ Inheritance diagram for IG.Crypto.CryptoManager:
+ Collaboration diagram for IG.Crypto.CryptoManager:

Public Member Functions

 CryptoManager ()
 
 CryptoManager (int outputLevel)
 
string GetFreeParameter (int whichParameter)
 Returns the specified free parameter (obtained from commans-line arguments). More...
 
virtual void ParseCommandlineParameters (string appName, string[] args)
 Reads parameters for cryptographic operations to be performed from the specified command line. More...
 
virtual void GetInputFilePaths (ref List< string > inputFilePaths, bool enableWildcards=true, bool addRecursive=true, bool clearBefore=true)
 Gets a list of input files specified by command-line arguments that had been previously parsed by the ParseCommandlineParameters method. More...
 
virtual string AppEncryptSymmetricBasic (string appName, string[] args)
 Executes command-line action - symmetric encryption of files or text by using BASIC class of methods. More...
 
virtual string AppDecryptSymmetricBasic (string appName, string[] args)
 Executes command-line action - symmetric decryption of files or text by using BASIC class of methods. More...
 
virtual string AppEncryptSymmetricPlain (string appName, string[] args)
 Executes command-line action - symmetric encryption of files or text by using PLAIN class of methods. More...
 
virtual string AppDecryptSymmetricPlain (string appName, string[] args)
 Executes command-line action - symmetric decryption of files or text by using PLAIN class of methods. More...
 
virtual string AppGetFileHash (string appName, string[] args)
 Executes command-line action - calculation of various hashRet values of a file. More...
 
virtual string AppCheckSum (string appName, string[] args)
 Executes command-line action - calculation of various hashRet values of files or text. More...
 
virtual string AppConvert (string appName, string[] args)
 Executes command-line action - conversion between different representations of data. More...
 
virtual string AppCleanFiles (string appName, string[] args)
 Executes command-line action - deletion of eventual redundant files that remained in the file system after cryptographic operations.. More...
 
virtual string AppTimeKeyGeneration (string appName, string[] args)
 Executes command-line action - measuring time of password generaton algorithms. More...
 
virtual string AppGetKey (string appName, string[] args)
 Executes command-line action - generates a random initialization vector for symmetric encryption. More...
 
virtual string AppGetInitializationVector (string appName, string[] args)
 Executes command-line action - generates a random initialization vector for symmetric encryption. More...
 
virtual string AppGetSalt (string appName, string[] args)
 Executes command-line action - generates a random salt bytes. More...
 
virtual int ResolvePasswordParameters (int whichFreeParameterkeyLength=0, int whichFreeParameterNumIterations=1)
 Resolves password related parameters such as password, salt, and generated key length. More...
 
virtual void ResolveAsymParameters ()
 Resolves asymmetric algorithm parameters from the information that has been previously obtained through command-line parameters. More...
 
virtual string AppAsymKeyInfo (string appName, string[] args)
 Executes command-line action - prints information about asymmetric keys specified by command-line parameters. More...
 
virtual string AppAsymExportKey (string appName, string[] args)
 Executes command-line action - exports asymmetric keys specified by command-line parameters. More...
 
virtual string AppCertStoreInfo (string appName, string[] args)
 Executes command-line action - prints information about the certificate stores specified by command-line parameters. More...
 
virtual string AppAddCertificate (string appName, string[] args)
 Executes command-line action - prints information about the certificate stores specified by command-line parameters. More...
 
virtual string AppRemoveCertificate (string appName, string[] args)
 Executes command-line action - removes certificate with the specified name from the specified certificate store. More...
 
virtual string AppCertInfo (string appName, string[] args)
 Executes command-line action - prints information about the certificate specified by command-line parameters. More...
 
virtual string AppAsymTest (string appName, string[] args)
 Executes command-line action - a couple of custom asymmetric encryption-related tests. More...
 
- Public Member Functions inherited from IG.Crypto.CryptoParameters
 CryptoParameters ()
 
void Reset ()
 Resets the state. More...
 
bool IsFlagsSet (params CryptoFlags[] whichFlags)
 Returns true if ALL the specified flags are set, or false if some of them are unset. More...
 
bool IsAnyFlagSet (params CryptoFlags[] whichFlags)
 Returns true if any of the specified flags is set, or false if none of them is set. More...
 
void SetFlags (params CryptoFlags[] whichFlags)
 Sets the specified flags. More...
 
void ClearFlags (CryptoFlags firstFlags, params CryptoFlags[] whichFlags)
 Clears the specified flags. More...
 
void ClearAllFlags ()
 Clears all flags. More...
 

Protected Member Functions

virtual void ReportError (string errorString)
 Used in the current class to report an error. More...
 
virtual void ReportWarning (string errorString)
 Used in the current class to launch a warning message. More...
 
virtual void ReportInfo (string errorString)
 Used in the current class to launch an informative message. More...
 
virtual void WarnAboutPlainEncryption ()
 Writes a notification informing that a cryptographic task has been delegated to the CryptoParameters class. More...
 
virtual void WarnExportPrivateKey ()
 Writes a notification informing that a private key may be exported. More...
 
virtual string AppEncryptSymmetricAll (string appName, string[] args, bool isDecrypt=false, bool isPlain=false, bool isBasic=false)
 Executes command-line action - symmetric encryption of files or text. More...
 
virtual string AppKeyGenerationAll (string appName, string[] args, bool measureTimes, int numGenerations)
 Executes command-line action - one of the actions related to key generation. More...
 

Protected Attributes

bool _isDecrypt = false
 
bool _isLargestKey = false
 

Properties

int OutputLevel [get, set]
 Level of output during operation. More...
 
string AppName [get, protected set]
 
string[] AppArguments [get, set]
 Last (or currently) read command-line arguments. More...
 
int NumAppArguments [get]
 Number of command-line arguments. More...
 
PasswordAlgorithmType PasswordAlgorithmType [get, set]
 Type of the algorithm used for password hashing. More...
 
string PasswordAlgorithmTypeString [get, set]
 Name of the algorithm used in password hashing. More...
 
PasswordAlgorithmBase PasswordAlgorithm [get, set]
 Password hashing algorithm. More...
 
string AlgorithmTypeString [get, set]
 String representation of algorithm type. More...
 
HashType HashAlgorithmType [get, set]
 Hashing algorithm type. More...
 
SymmetricAlgorithmType SymmetricAlgorithmType [get, set]
 Symmetric algorithm type. More...
 
bool IsDecrypt [get, protected set]
 Whether decryption is perrformed, rather than encryption. More...
 
bool IsEncrypt [get, protected set]
 Whether decryption is perrformed, rather than encryption. More...
 
bool IsExportPrivateKey [get, protected set]
 Whether private key is also exported or printed. More...
 
AsymmetricAlgorithmType AsymAlgorithmType [get, protected set]
 
AsymmetricAlgorithm AsymAlgorithm [get, set]
 Asymmetric algorithm, equipped with keys, that will perform asymmetric cryptographic tasks. More...
 
CspProviderFlags AsymFlags [get, set]
 Asymmetric CSP (crypto service provider) flags. More...
 
string AsymAlgorithmTypeString [get, protected set]
 String that represents asymmetric algorithm type. More...
 
string AsymKeyContainerName [get, protected set]
 Asymmetric key container name. More...
 
string AsymKeyFileXml [get, protected set]
 Asymmetric key file path in XML format. More...
 
string CertificatePath [get, protected set]
 Path to the certificate file (e.g. for obtaining asymmetric keys). More...
 
string CertificateName [get, protected set]
 Certificate name (usually specified to locate the certificate in a certificate store). More...
 
string CertificateStoreName [get, protected set]
 Name of the certificate store (usually, to locate the specified certificate). More...
 
int CertificateStoreLocation [get, protected set]
 Location of the certificate store (usually used to filter certificate stores). More...
 
bool IsCertificatePasswordThroughUi [get, protected set]
 Indicates that pasword for private key should obtained from the user through GUI (usually through console). More...
 
string CertificatePassword [get, set]
 Password for accessing private keys (e.g. for private keys associated with certificate). More...
 
string HashValue [get, set]
 Hash value, usually used for checking consistency. More...
 
bool IsStringInput [get, set]
 Flag indicating that input are strings or encoded byte arrays, rather than files. More...
 
int PasswordLength [get, set]
 Length of the (generated) password. More...
 
string PasswordString [get, set]
 
byte[] PasswordBytes [get, set]
 Password as byte array. More...
 
int SaltLength [get, set]
 Length of salt. More...
 
string SaltString [get, set]
 Salt string. More...
 
byte[] SaltBytes [get, set]
 Salt as byte array. More...
 
int IvLength [get, set]
 Length of the initialization vector. More...
 
string IvString [get, set]
 Initialization vector in string form. More...
 
byte[] IvBytes [get, set]
 Initialization vector as byte array. More...
 
int KeyLength [get, set]
 Length of the key. More...
 
byte[] KeyBytes [get, set]
 Secret key as byte array. More...
 
bool IsLargestKey [get, set]
 Whether the largest available key size for the algorithm in use is taken. More...
 
int NumPasswordIterations [get, set]
 Number of iterations in passworg hashing algorithms, aimed at increasing processing effort to break the password. More...
 
List< string > FreeParameters [get]
 List of free parameters from the parsed command-line. More...
 
int NumFreeParameters [get]
 Number of free parameters (obtained from commans-line arguments). More...
 
string ReturnedString [get, set]
 Returned value of command-line application methods. More...
 
bool IsChecked [get, set]
 Indicates that something is verified, not calculated (or checked in addition, after calculation). More...
 
double TargetedTotalTime [get, set]
 Total time targeted in multi-pass algorithms (e.g. in password hashing). More...
 
bool IsInputFormatString [get, set]
 Whether input format is ordinary string. Returns true if there is no binary format specified, false if there is. More...
 
bool IsInputFormatLongInt [get, protected set]
 
bool IsInputFormat64 [get, protected set]
 Whether input is in form of base-64 encoded byte array. More...
 
bool IsInputFormatHex [get, protected set]
 Whether input is in form of hexadecimal encoded byte array. More...
 
bool IsOutputFormatString [get, set]
 Whether output format is ordinary string. Returns true if there is no binary format specified, false if there is. More...
 
bool IsOutputFormatLongInt [get, protected set]
 Whether output is in form of long integer. More...
 
bool IsOutputFormat64 [get, protected set]
 Whether output is in form of base-64 encoded byte array. More...
 
bool IsOutputFormatHex [get, protected set]
 Whether output is in form of hexadecimal encoded byte array. More...
 
- Properties inherited from IG.Crypto.CryptoParameters
CryptoFlags Flags [get, private set]
 Flags for cryptographic operations performed. More...
 

Private Attributes

int _outputLevel = 2
 
string _appName = null
 
string[] _appArguments = null
 
PasswordAlgorithmType _passwordAlgorithmType = PasswordAlgorithmType.Default
 
string _passwordAlgorithmTypeString = null
 
PasswordAlgorithmBase _passwordAlgorithm = null
 
string _algorithmTypeString = null
 
HashType _hashAlgorithmType = HashType.Default
 
SymmetricAlgorithmType _symmetricAlgorithmType = SymmetricAlgorithmType.Default
 
bool _isExportPrivateKey = false
 
AsymmetricAlgorithmType _asymAlgorithmType = AsymmetricAlgorithmType.Default
 
AsymmetricAlgorithm _asymAlgorithm = null
 
CspProviderFlags _asymFlags = CspProviderFlags.NoFlags
 
string _asymAlgorithmTypeString = null
 
string _asymKeyContainerName = null
 
string _asymKeyFileXml = null
 
string _certificatePath = null
 
string _certificateName = null
 
string _certificateStoreName = null
 
int _certificateStoreLocation = 0
 
bool _certificatePasswordThroughUi = false
 
string _certificatePassword = null
 
string _hashValue = null
 
bool _isStringInput = false
 
int _passwordLength = 0
 
string _passwordString = null
 
byte[] _passwordBytes = null
 
int _saltLength = 0
 
string _saltString = null
 
byte[] _saltBytes = null
 
int _ivLength = 0
 
string _ivString = null
 
byte[] _ivBytes = null
 
int _keyLength = 0
 
byte[] _keyBytes = null
 
int _numPasswordIterations = 0
 
List< string > _freeParameters = new List<string>()
 
string _returnedString = null
 
bool _isChecked = false
 
double _targetedTotalTime = 0.1
 
string OutputPath = null
 
List< string > RecursivePathList = new List<string>()
 
List< string > RecursivePathListByLevels = new List<string>()
 
List< string > RecursiveFilePatterns = new List<string>()
 
int RecursiveDirectoryLevels = -1
 
bool IsRelativePaths = false
 
bool IsAbsolutePaths = false
 
bool IsDeleteOriginal = false
 Specifies whether the original files should be deleted. More...
 
bool IsDeleteEncrypted = false
 Specifies whether the encrypted files should be deleted. More...
 
bool IsDeleteDecrypted = false
 Specifies whether the encrypted files should be deleted. More...
 
bool IsDeleteAllVersions = false
 Specifies whether all versions of a file (e.g. original, encrypted, and decrypted) are allowed to be deleted (e.g. in a file clean-up operation). More...
 
bool IsForceOverwrites = false
 If true then eventual file overwtires are automatically performed by the relevant operation without asking for user's approval. More...
 
bool IsSkipOverwrites = false
 If true then eventual file overwrites are automatically wasSkipped by the relevant operation. More...
 
bool IsForceDeletes = false
 
bool IsSkipDeletes = false
 
bool IsInputFormatEqualOutputFormat = false
 If true then options for input formats and output format are treated interchangeably in the currentt context (e.g. in the current command-line application). More...
 
bool _isInputFormatLongInt = false
 
bool _isInputFormat64 = false
 
bool _isInputFormatHex = false
 
bool _isOutputFormatLongInt = false
 
bool _isOutputFormat64 = false
 
bool _isOutputFormatHex = false
 

Static Private Attributes

static int _numNotifyPlainEncryption = 0
 
static int _numNotifyExportPrivateKey = 0
 

Detailed Description

Performs high level cryptographic opereratins, such ass reading command-line parameters and performing high-level tasks that can be directly used in application commands (i.e. those commands that are installed on applicaition interpreters).

Constructor & Destructor Documentation

IG.Crypto.CryptoManager.CryptoManager ( )
inline
IG.Crypto.CryptoManager.CryptoManager ( int  outputLevel)
inline

Member Function Documentation

virtual void IG.Crypto.CryptoManager.ReportError ( string  errorString)
inlineprotectedvirtual

Used in the current class to report an error.

Parameters
errorStringError message that is a part of the output generated by this function.
virtual void IG.Crypto.CryptoManager.ReportWarning ( string  errorString)
inlineprotectedvirtual

Used in the current class to launch a warning message.

Parameters
errorStringWarning message that is a part of the output generated by this function.
virtual void IG.Crypto.CryptoManager.ReportInfo ( string  errorString)
inlineprotectedvirtual

Used in the current class to launch an informative message.

Parameters
errorStringWarning message that is a part of the output generated by this function.
virtual void IG.Crypto.CryptoManager.WarnAboutPlainEncryption ( )
inlineprotectedvirtual

Writes a notification informing that a cryptographic task has been delegated to the CryptoParameters class.

virtual void IG.Crypto.CryptoManager.WarnExportPrivateKey ( )
inlineprotectedvirtual

Writes a notification informing that a private key may be exported.

string IG.Crypto.CryptoManager.GetFreeParameter ( int  whichParameter)
inline

Returns the specified free parameter (obtained from commans-line arguments).

Parameters
whichParameterIndex of the free parameter to be returned.
virtual void IG.Crypto.CryptoManager.ParseCommandlineParameters ( string  appName,
string[]  args 
)
inlinevirtual

Reads parameters for cryptographic operations to be performed from the specified command line.

Parameters read from this function can be used by any high level function that actually performs cryptographic operations.

Parameters
appNameName of the embedded application for which parameters are read.
argsArguments of the embedded application's command.

References IG.Lib.Util.FromHexString(), IG.Crypto.UtilCrypto.GetAsymmetricAlgorithmType(), IG.Crypto.UtilCrypto.GetCspProviderFlags(), IG.Crypto.UtilCrypto.GetHashType(), IG.Crypto.UtilCrypto.GetPasswordAlgorithmType(), and IG.Crypto.UtilCrypto.GetSymmetricAlgorithmType().

virtual void IG.Crypto.CryptoManager.GetInputFilePaths ( ref List< string >  inputFilePaths,
bool  enableWildcards = true,
bool  addRecursive = true,
bool  clearBefore = true 
)
inlinevirtual

Gets a list of input files specified by command-line arguments that had been previously parsed by the ParseCommandlineParameters method.

Parameters
inputFilePathsList where the obtained input file paths are stored.
enableWildcardsIf true (which is default) then file paths listed as free parameters will be resolved by expanding wildcard characters.
addRecursiveIf true (which is default) then files obtained by recursive directory listings are also included.
clearBeforeIf true (which is default) then the list inputFilePaths is cleared before operation. If false then extracted file paths are added to the eventual existing items already on the list. This is an untypical situation and there will rarely bee any need for this.

References IG.Lib.UtilSystem.GetAbsolutePath(), IG.Lib.UtilSystem.GetRelativePath(), IG.Lib.UtilSystem.ListFilesByLevels(), and IG.Lib.UtilSystem.ListFilesRecursively().

virtual string IG.Crypto.CryptoManager.AppEncryptSymmetricBasic ( string  appName,
string[]  args 
)
inlinevirtual

Executes command-line action - symmetric encryption of files or text by using BASIC class of methods.

Parameters
appNameName of the embedded application.
argsArguments of the embedded application's command.

Referenced by IG.Script.ScriptAppBase.CryptoFunctionEncryptBasic().

virtual string IG.Crypto.CryptoManager.AppDecryptSymmetricBasic ( string  appName,
string[]  args 
)
inlinevirtual

Executes command-line action - symmetric decryption of files or text by using BASIC class of methods.

Parameters
appNameName of the embedded application.
argsArguments of the embedded application's command.

Referenced by IG.Script.ScriptAppBase.CryptoFunctionDecryptBasic().

virtual string IG.Crypto.CryptoManager.AppEncryptSymmetricPlain ( string  appName,
string[]  args 
)
inlinevirtual

Executes command-line action - symmetric encryption of files or text by using PLAIN class of methods.

Parameters
appNameName of the embedded application.
argsArguments of the embedded application's command.

Referenced by IG.Script.ScriptAppBase.CryptoFunctionEncryptPlain().

virtual string IG.Crypto.CryptoManager.AppDecryptSymmetricPlain ( string  appName,
string[]  args 
)
inlinevirtual

Executes command-line action - symmetric decryption of files or text by using PLAIN class of methods.

Parameters
appNameName of the embedded application.
argsArguments of the embedded application's command.

Referenced by IG.Script.ScriptAppBase.CryptoFunctionDecryptPlain().

virtual string IG.Crypto.CryptoManager.AppEncryptSymmetricAll ( string  appName,
string[]  args,
bool  isDecrypt = false,
bool  isPlain = false,
bool  isBasic = false 
)
inlineprotectedvirtual

Executes command-line action - symmetric encryption of files or text.

Parameters
appNameName of the embedded application.
argsArguments of the embedded application's command.
isDecryptIf true then decryption is performed, otherwise encryption is performed.
isPlainIf true then PLAIN class of encryption/decrypton methods is used.
isBasicIf true then BASIC class of encryption/decryption metthods is used.

References IG.Lib.StopWatch1.CpuTime, IG.Crypto.UtilCrypto.DecryptFilePlain(), IG.Crypto.UtilCrypto.DecryptPlain(), IG.Crypto.UtilCrypto.DecryptStringPlain(), IG.Crypto.UtilCrypto.EncryptFilePlain(), IG.Crypto.UtilCrypto.EncryptPlain(), IG.Crypto.UtilCrypto.EncryptStringPlain(), IG.Lib.Util.FromHexString(), IG.Lib.UtilConsole.Read(), IG.Lib.UtilConsole.ReadPwd(), IG.Lib.StopWatch1.Start(), IG.Lib.StopWatch1.Stop(), IG.Crypto.UtilCrypto.StringEncoding, IG.Crypto.UtilCrypto.SymmetricAlgorithmTypeToString(), IG.Lib.StopWatch1.Time, IG.Lib.Util.ToHexString(), IG.Lib.StopWatch1.TotalCpuTime, and IG.Lib.StopWatch1.TotalTime.

virtual string IG.Crypto.CryptoManager.AppGetFileHash ( string  appName,
string[]  args 
)
inlinevirtual

Executes command-line action - calculation of various hashRet values of a file.

Parameters
appNameName of the embedded application.
argsArguments of the embedded application's command.

References IG.Crypto.UtilCrypto.GetFileHashMd5Hex(), IG.Crypto.UtilCrypto.GetFileHashSha1Hex(), IG.Crypto.UtilCrypto.GetFileHashSha256Hex(), IG.Crypto.UtilCrypto.GetFileHashSha512Hex(), IG.Lib.UtilConsole.Read(), and IG.Lib.UtilStr.ToBoolean().

Referenced by IG.Script.ScriptAppBase.CryptoFunctionGetFileHash().

virtual string IG.Crypto.CryptoManager.AppCheckSum ( string  appName,
string[]  args 
)
inlinevirtual
virtual string IG.Crypto.CryptoManager.AppConvert ( string  appName,
string[]  args 
)
inlinevirtual

Executes command-line action - conversion between different representations of data.

Parameters
appNameName of the embedded application.
argsArguments of the embedded application's command.

References IG.Lib.Util.FromHexString(), IG.Lib.Util.ToByteArray(), and IG.Lib.Util.ToHexString().

Referenced by IG.Script.ScriptAppBase.CryptoFunctionConvert().

virtual string IG.Crypto.CryptoManager.AppCleanFiles ( string  appName,
string[]  args 
)
inlinevirtual

Executes command-line action - deletion of eventual redundant files that remained in the file system after cryptographic operations..

Parameters
appNameName of the embedded application.
argsArguments of the embedded application's command.

References IG.Lib.UtilConsole.Read().

Referenced by IG.Script.ScriptAppBase.CryptoFunctionCleanFiles().

virtual string IG.Crypto.CryptoManager.AppTimeKeyGeneration ( string  appName,
string[]  args 
)
inlinevirtual

Executes command-line action - measuring time of password generaton algorithms.

Key generation algorithm type and other parameters such as password and salt are determined by command-line options.

Parameters
appNameName of the embedded application.
argsArguments of the embedded application's command.

Referenced by IG.Script.ScriptAppBase.CryptoFunctionTimeKeyGeneration().

virtual string IG.Crypto.CryptoManager.AppGetKey ( string  appName,
string[]  args 
)
inlinevirtual

Executes command-line action - generates a random initialization vector for symmetric encryption.

Key generation algorithm type and other parameters such as password and salt are determined by command-line options.

Parameters
appNameName of the embedded application.
argsArguments of the embedded application's command.

Referenced by IG.Script.ScriptAppBase.CryptoFunctionGetKey().

virtual string IG.Crypto.CryptoManager.AppGetInitializationVector ( string  appName,
string[]  args 
)
inlinevirtual

Executes command-line action - generates a random initialization vector for symmetric encryption.

Key generation algorithm type and other parameters such as password and salt are determined by command-line options.

Parameters
appNameName of the embedded application.
argsArguments of the embedded application's command.

Referenced by IG.Script.ScriptAppBase.CryptoFunctionGetInitializationVector().

virtual string IG.Crypto.CryptoManager.AppGetSalt ( string  appName,
string[]  args 
)
inlinevirtual

Executes command-line action - generates a random salt bytes.

Key generation algorithm type and other parameters such as password and salt are determined by command-line options.

Parameters
appNameName of the embedded application.
argsArguments of the embedded application's command.

Referenced by IG.Script.ScriptAppBase.CryptoFunctionGetSalt().

virtual int IG.Crypto.CryptoManager.ResolvePasswordParameters ( int  whichFreeParameterkeyLength = 0,
int  whichFreeParameterNumIterations = 1 
)
inlinevirtual

Resolves password related parameters such as password, salt, and generated key length.

Paremeters that determine which free paremeters map to password-related parameters such as key length and number of iterations of key generation algorithm, must fill free parameters up to the specified index.

Parameters
whichFreeParameterkeyLengthIndex of free parameter that can eventually represent the key length. If less than 0 then key length can not be specified by free parameters.
whichFreeParameterNumIterationsIndex of free parameter that can eventually represent the number of iterations in password generating algorithm. If less than 0 then number of key generation iterations can not be specified by free parameters.
Returns
Number of free parameters that were eventually used for resolving password-related parameters.

References IG.Crypto.UtilCrypto.GetRandomBytes(), and IG.Crypto.UtilCrypto.StringEncoding.

virtual string IG.Crypto.CryptoManager.AppKeyGenerationAll ( string  appName,
string[]  args,
bool  measureTimes,
int  numGenerations 
)
inlineprotectedvirtual

Executes command-line action - one of the actions related to key generation.

Parameters
appNameName of the embedded application.
argsArguments of the embedded application's command.
measureTimesIf true then time necessary for key generation with given parameters is measured. Otherwise, the key is actually created. The key can also be used as initialization vector.
numGenerationsNumber of repetirions of key algorithm before return. This makes possible to to generate different outputs e.g. for key, for initialization vector, or for salt.

References IG.Crypto.UtilCrypto.GetPasswordAlgorithm(), IG.Crypto.UtilCrypto.GetPasswordAlgorithmType(), IG.Crypto.PasswordAlgorithmBase.Init(), IG.Lib.StopWatch1.TestExecutionTime(), and IG.Lib.Util.ToHexString().

virtual void IG.Crypto.CryptoManager.ResolveAsymParameters ( )
inlinevirtual

Resolves asymmetric algorithm parameters from the information that has been previously obtained through command-line parameters.

References IG.Crypto.UtilCrypto.GetAsymmetricAlgorithm(), and IG.Crypto.UtilCrypto.GetAsymmetricAlgorithmType().

virtual string IG.Crypto.CryptoManager.AppAsymKeyInfo ( string  appName,
string[]  args 
)
inlinevirtual

Executes command-line action - prints information about asymmetric keys specified by command-line parameters.

Information necessary to access the asymmetric keys is extracted from command-line parameters.

Parameters
appNameName of the embedded application.
argsArguments of the embedded application's command.

References IG.Crypto.UtilCrypto.AsymEncryptionDecryptionTest(), IG.Crypto.DSA, IG.Crypto.UtilCrypto.GetAsymmetricalgorithmHash(), IG.Crypto.UtilCrypto.GetMaximalAsymmetricTextLength(), IG.Crypto.UtilCrypto.ToString(), and IG.Lib.Util.XmlToString().

Referenced by IG.Script.ScriptAppBase.CryptoFunctionAsymKeyInfo().

virtual string IG.Crypto.CryptoManager.AppAsymExportKey ( string  appName,
string[]  args 
)
inlinevirtual

Executes command-line action - exports asymmetric keys specified by command-line parameters.

Information necessary to access the asymmetric keys is extracted from command-line parameters.

Parameters
appNameName of the embedded application.
argsArguments of the embedded application's command.

References IG.Crypto.UtilCrypto.AsymEncryptionDecryptionTest(), IG.Crypto.UtilCrypto.GetAsymmetricalgorithmHash(), IG.Crypto.UtilCrypto.GetMaximalAsymmetricTextLength(), IG.Lib.UtilConsole.Read(), IG.Crypto.UtilCrypto.ToString(), and IG.Lib.Util.XmlToString().

virtual string IG.Crypto.CryptoManager.AppCertStoreInfo ( string  appName,
string[]  args 
)
inlinevirtual

Executes command-line action - prints information about the certificate stores specified by command-line parameters.

Information necessary to access the stores is extracted from command-line parameters.

Parameters
appNameName of the embedded application.
argsArguments of the embedded application's command.

References IG.Crypto.UtilCrypto.GetCertificateStoreDescription().

Referenced by IG.Script.ScriptAppBase.CryptoFunctionCertStoreInfo().

virtual string IG.Crypto.CryptoManager.AppAddCertificate ( string  appName,
string[]  args 
)
inlinevirtual

Executes command-line action - prints information about the certificate stores specified by command-line parameters.

Information necessary to access the stores is extracted from command-line parameters.

Parameters
appNameName of the embedded application.
argsArguments of the embedded application's command.

References IG.Crypto.UtilCrypto.AddCertificateToStore(), IG.Crypto.UtilCrypto.GetCertificate(), IG.Crypto.UtilCrypto.GetSimpleName(), and IG.Lib.UtilConsole.ReadPwd().

Referenced by IG.Script.ScriptAppBase.CryptoFunctionAddCertificate().

virtual string IG.Crypto.CryptoManager.AppRemoveCertificate ( string  appName,
string[]  args 
)
inlinevirtual

Executes command-line action - removes certificate with the specified name from the specified certificate store.

Information about the certificate name and the store is extracted from command-line parameters.

Parameters
appNameName of the embedded application.
argsArguments of the embedded application's command.

References IG.Crypto.UtilCrypto.DeleteCertificateFromStore().

Referenced by IG.Script.ScriptAppBase.CryptoFunctionRemoveCertificate().

virtual string IG.Crypto.CryptoManager.AppCertInfo ( string  appName,
string[]  args 
)
inlinevirtual

Executes command-line action - prints information about the certificate specified by command-line parameters.

Information necessary to access the certificate is extracted from command-line parameters.

Parameters
appNameName of the embedded application.
argsArguments of the embedded application's command.

References IG.Crypto.UtilCrypto.AsymEncryptionDecryptionTest(), IG.Crypto.DSA, IG.Crypto.UtilCrypto.GetAsymmetricalgorithmHash(), IG.Crypto.UtilCrypto.GetCertificate(), IG.Crypto.UtilCrypto.GetMaximalAsymmetricTextLength(), IG.Lib.UtilConsole.ReadPwd(), and IG.Crypto.UtilCrypto.ToString().

Referenced by IG.Script.ScriptAppBase.CryptoFunctionCertInfo().

virtual string IG.Crypto.CryptoManager.AppAsymTest ( string  appName,
string[]  args 
)
inlinevirtual

Member Data Documentation

int IG.Crypto.CryptoManager._numNotifyPlainEncryption = 0
staticprivate
int IG.Crypto.CryptoManager._numNotifyExportPrivateKey = 0
staticprivate
int IG.Crypto.CryptoManager._outputLevel = 2
private
string IG.Crypto.CryptoManager._appName = null
private
string [] IG.Crypto.CryptoManager._appArguments = null
private
PasswordAlgorithmType IG.Crypto.CryptoManager._passwordAlgorithmType = PasswordAlgorithmType.Default
private
string IG.Crypto.CryptoManager._passwordAlgorithmTypeString = null
private
PasswordAlgorithmBase IG.Crypto.CryptoManager._passwordAlgorithm = null
private
string IG.Crypto.CryptoManager._algorithmTypeString = null
private
HashType IG.Crypto.CryptoManager._hashAlgorithmType = HashType.Default
private
SymmetricAlgorithmType IG.Crypto.CryptoManager._symmetricAlgorithmType = SymmetricAlgorithmType.Default
private
bool IG.Crypto.CryptoManager._isDecrypt = false
protected
bool IG.Crypto.CryptoManager._isExportPrivateKey = false
private
AsymmetricAlgorithmType IG.Crypto.CryptoManager._asymAlgorithmType = AsymmetricAlgorithmType.Default
private
AsymmetricAlgorithm IG.Crypto.CryptoManager._asymAlgorithm = null
private
CspProviderFlags IG.Crypto.CryptoManager._asymFlags = CspProviderFlags.NoFlags
private
string IG.Crypto.CryptoManager._asymAlgorithmTypeString = null
private
string IG.Crypto.CryptoManager._asymKeyContainerName = null
private
string IG.Crypto.CryptoManager._asymKeyFileXml = null
private
string IG.Crypto.CryptoManager._certificatePath = null
private
string IG.Crypto.CryptoManager._certificateName = null
private
string IG.Crypto.CryptoManager._certificateStoreName = null
private
int IG.Crypto.CryptoManager._certificateStoreLocation = 0
private
bool IG.Crypto.CryptoManager._certificatePasswordThroughUi = false
private
string IG.Crypto.CryptoManager._certificatePassword = null
private
string IG.Crypto.CryptoManager._hashValue = null
private
bool IG.Crypto.CryptoManager._isStringInput = false
private
int IG.Crypto.CryptoManager._passwordLength = 0
private
string IG.Crypto.CryptoManager._passwordString = null
private
byte [] IG.Crypto.CryptoManager._passwordBytes = null
private
int IG.Crypto.CryptoManager._saltLength = 0
private
string IG.Crypto.CryptoManager._saltString = null
private
byte [] IG.Crypto.CryptoManager._saltBytes = null
private
int IG.Crypto.CryptoManager._ivLength = 0
private
string IG.Crypto.CryptoManager._ivString = null
private
byte [] IG.Crypto.CryptoManager._ivBytes = null
private
int IG.Crypto.CryptoManager._keyLength = 0
private
byte [] IG.Crypto.CryptoManager._keyBytes = null
private
bool IG.Crypto.CryptoManager._isLargestKey = false
protected
int IG.Crypto.CryptoManager._numPasswordIterations = 0
private
List<string> IG.Crypto.CryptoManager._freeParameters = new List<string>()
private
string IG.Crypto.CryptoManager._returnedString = null
private
bool IG.Crypto.CryptoManager._isChecked = false
private
double IG.Crypto.CryptoManager._targetedTotalTime = 0.1
private
string IG.Crypto.CryptoManager.OutputPath = null
private
List<string> IG.Crypto.CryptoManager.RecursivePathList = new List<string>()
private
List<string> IG.Crypto.CryptoManager.RecursivePathListByLevels = new List<string>()
private
List<string> IG.Crypto.CryptoManager.RecursiveFilePatterns = new List<string>()
private
int IG.Crypto.CryptoManager.RecursiveDirectoryLevels = -1
private
bool IG.Crypto.CryptoManager.IsRelativePaths = false
private
bool IG.Crypto.CryptoManager.IsAbsolutePaths = false
private
bool IG.Crypto.CryptoManager.IsDeleteOriginal = false
private

Specifies whether the original files should be deleted.

This can refer to deletion of the original file(s) after encryption or decryption, or to deletion of the original file in a group(s) of associated files (original, encrypted, decrypted).

bool IG.Crypto.CryptoManager.IsDeleteEncrypted = false
private

Specifies whether the encrypted files should be deleted.

This can refer to deletion of the encrypted file(s) in a group(s) of associated files (original, encrypted, decrypted) during a separate clean-up operation.

bool IG.Crypto.CryptoManager.IsDeleteDecrypted = false
private

Specifies whether the encrypted files should be deleted.

This can refer to deletion of the decrypted file(s) in a group(s) of associated files (original, encrypted, decrypted) during a separate clean-up operation.

bool IG.Crypto.CryptoManager.IsDeleteAllVersions = false
private

Specifies whether all versions of a file (e.g. original, encrypted, and decrypted) are allowed to be deleted (e.g. in a file clean-up operation).

bool IG.Crypto.CryptoManager.IsForceOverwrites = false
private

If true then eventual file overwtires are automatically performed by the relevant operation without asking for user's approval.

bool IG.Crypto.CryptoManager.IsSkipOverwrites = false
private

If true then eventual file overwrites are automatically wasSkipped by the relevant operation.

This means that whenever the operation in question would normally have to overwrite an existent file, this is wasSkipped, without even asking ro user's approval. For example, if decryption is performed but some of the original files already exist then these files will not be dcrypted as the operation would heve to overrwrite the original files.

bool IG.Crypto.CryptoManager.IsForceDeletes = false
private
bool IG.Crypto.CryptoManager.IsSkipDeletes = false
private
bool IG.Crypto.CryptoManager.IsInputFormatEqualOutputFormat = false
private

If true then options for input formats and output format are treated interchangeably in the currentt context (e.g. in the current command-line application).

bool IG.Crypto.CryptoManager._isInputFormatLongInt = false
private
bool IG.Crypto.CryptoManager._isInputFormat64 = false
private
bool IG.Crypto.CryptoManager._isInputFormatHex = false
private
bool IG.Crypto.CryptoManager._isOutputFormatLongInt = false
private
bool IG.Crypto.CryptoManager._isOutputFormat64 = false
private
bool IG.Crypto.CryptoManager._isOutputFormatHex = false
private

Property Documentation

int IG.Crypto.CryptoManager.OutputLevel
getsetprivate

Level of output during operation.

string IG.Crypto.CryptoManager.AppName
getprotected set
string [] IG.Crypto.CryptoManager.AppArguments
getset

Last (or currently) read command-line arguments.

int IG.Crypto.CryptoManager.NumAppArguments
getprivate

Number of command-line arguments.

PasswordAlgorithmType IG.Crypto.CryptoManager.PasswordAlgorithmType
getsetprivate

Type of the algorithm used for password hashing.

string IG.Crypto.CryptoManager.PasswordAlgorithmTypeString
getsetprivate

Name of the algorithm used in password hashing.

PasswordAlgorithmBase IG.Crypto.CryptoManager.PasswordAlgorithm
getsetprivate

Password hashing algorithm.

string IG.Crypto.CryptoManager.AlgorithmTypeString
getsetprivate

String representation of algorithm type.

HashType IG.Crypto.CryptoManager.HashAlgorithmType
getsetprivate

Hashing algorithm type.

SymmetricAlgorithmType IG.Crypto.CryptoManager.SymmetricAlgorithmType
getsetprivate

Symmetric algorithm type.

bool IG.Crypto.CryptoManager.IsDecrypt
getprotected set

Whether decryption is perrformed, rather than encryption.

bool IG.Crypto.CryptoManager.IsEncrypt
getprotected set

Whether decryption is perrformed, rather than encryption.

bool IG.Crypto.CryptoManager.IsExportPrivateKey
getprotected set

Whether private key is also exported or printed.

AsymmetricAlgorithmType IG.Crypto.CryptoManager.AsymAlgorithmType
getprotected set
AsymmetricAlgorithm IG.Crypto.CryptoManager.AsymAlgorithm
getsetprotected

Asymmetric algorithm, equipped with keys, that will perform asymmetric cryptographic tasks.

CspProviderFlags IG.Crypto.CryptoManager.AsymFlags
getset

Asymmetric CSP (crypto service provider) flags.

string IG.Crypto.CryptoManager.AsymAlgorithmTypeString
getprotected set

String that represents asymmetric algorithm type.

string IG.Crypto.CryptoManager.AsymKeyContainerName
getprotected set

Asymmetric key container name.

string IG.Crypto.CryptoManager.AsymKeyFileXml
getprotected set

Asymmetric key file path in XML format.

string IG.Crypto.CryptoManager.CertificatePath
getprotected set

Path to the certificate file (e.g. for obtaining asymmetric keys).

string IG.Crypto.CryptoManager.CertificateName
getprotected set

Certificate name (usually specified to locate the certificate in a certificate store).

string IG.Crypto.CryptoManager.CertificateStoreName
getprotected set

Name of the certificate store (usually, to locate the specified certificate).

int IG.Crypto.CryptoManager.CertificateStoreLocation
getprotected set

Location of the certificate store (usually used to filter certificate stores).

bool IG.Crypto.CryptoManager.IsCertificatePasswordThroughUi
getprotected set

Indicates that pasword for private key should obtained from the user through GUI (usually through console).

string IG.Crypto.CryptoManager.CertificatePassword
getsetprotected

Password for accessing private keys (e.g. for private keys associated with certificate).

string IG.Crypto.CryptoManager.HashValue
getsetprivate

Hash value, usually used for checking consistency.

bool IG.Crypto.CryptoManager.IsStringInput
getsetprivate

Flag indicating that input are strings or encoded byte arrays, rather than files.

int IG.Crypto.CryptoManager.PasswordLength
getsetprivate

Length of the (generated) password.

string IG.Crypto.CryptoManager.PasswordString
getsetprivate
byte [] IG.Crypto.CryptoManager.PasswordBytes
getsetprivate

Password as byte array.

int IG.Crypto.CryptoManager.SaltLength
getsetprivate

Length of salt.

string IG.Crypto.CryptoManager.SaltString
getsetprivate

Salt string.

byte [] IG.Crypto.CryptoManager.SaltBytes
getsetprivate

Salt as byte array.

int IG.Crypto.CryptoManager.IvLength
getsetprivate

Length of the initialization vector.

string IG.Crypto.CryptoManager.IvString
getsetprivate

Initialization vector in string form.

byte [] IG.Crypto.CryptoManager.IvBytes
getsetprivate

Initialization vector as byte array.

int IG.Crypto.CryptoManager.KeyLength
getsetprivate

Length of the key.

byte [] IG.Crypto.CryptoManager.KeyBytes
getsetprivate

Secret key as byte array.

bool IG.Crypto.CryptoManager.IsLargestKey
getsetprivate

Whether the largest available key size for the algorithm in use is taken.

int IG.Crypto.CryptoManager.NumPasswordIterations
getsetprivate

Number of iterations in passworg hashing algorithms, aimed at increasing processing effort to break the password.

List<string> IG.Crypto.CryptoManager.FreeParameters
getprotected

List of free parameters from the parsed command-line.

int IG.Crypto.CryptoManager.NumFreeParameters
get

Number of free parameters (obtained from commans-line arguments).

string IG.Crypto.CryptoManager.ReturnedString
getsetprivate

Returned value of command-line application methods.

bool IG.Crypto.CryptoManager.IsChecked
getsetprivate

Indicates that something is verified, not calculated (or checked in addition, after calculation).

double IG.Crypto.CryptoManager.TargetedTotalTime
getsetprotected

Total time targeted in multi-pass algorithms (e.g. in password hashing).

bool IG.Crypto.CryptoManager.IsInputFormatString
getsetprivate

Whether input format is ordinary string. Returns true if there is no binary format specified, false if there is.

bool IG.Crypto.CryptoManager.IsInputFormatLongInt
getprotected set
bool IG.Crypto.CryptoManager.IsInputFormat64
getprotected set

Whether input is in form of base-64 encoded byte array.

bool IG.Crypto.CryptoManager.IsInputFormatHex
getprotected set

Whether input is in form of hexadecimal encoded byte array.

bool IG.Crypto.CryptoManager.IsOutputFormatString
getsetprivate

Whether output format is ordinary string. Returns true if there is no binary format specified, false if there is.

bool IG.Crypto.CryptoManager.IsOutputFormatLongInt
getprotected set

Whether output is in form of long integer.

bool IG.Crypto.CryptoManager.IsOutputFormat64
getprotected set

Whether output is in form of base-64 encoded byte array.

bool IG.Crypto.CryptoManager.IsOutputFormatHex
getprotected set

Whether output is in form of hexadecimal encoded byte array.


The documentation for this class was generated from the following file: