Esempio n. 1
0
        public Stage3(Stage1 stage1, Stage2 stage2Reader, bool passwordRequired, PasswordManager passwordManager)
        {
            Stage1 = stage1;
            Reader = stage2Reader;
            PasswordRequired = passwordRequired;
            PasswordManager = passwordManager;
            _Directive = new Lazy<RequestType>(() =>
            {
                try {
                    return (RequestType)Enum.Parse(typeof(RequestType), Reader.Directive);
                }
                catch (Exception ex) {
                    throw new ParserException(ErrorType.InvalidRequest, "Directive", ex);
                }
            });
            _KeyHashAlgorithm = new Lazy<Cryptography.HashAlgorithmType>(() =>
            {
                try {
                    return Cryptography.GetKeyHashType(Reader.KeyHashAlgorithm);
                }
                catch (Exception ex) {
                    throw new ParserException(ErrorType.InvalidRequest, "KeyHashAlgorithm", ex);
                }
            });
            _EncryptionAlgorithm = new Lazy<Cryptography.SymmetricAlgorithmType>(() =>
            {
                try {
                    return Cryptography.GetEncryptionType(Reader.EncryptionAlgorithm);
                }
                catch (Exception ex) {
                    throw new ParserException(ErrorType.InvalidRequest, "EncryptionAlgorithm", ex);
                }
            });

        }
Esempio n. 2
0
 public Stage2(Stage1 stage1Reader,bool isLocal)
 {
     Reader = stage1Reader;
     RegHeader = isLocal ? RegHeaderLocal : RegHeaderRemote;
 }