示例#1
0
        public SecureBlackboxFtpHandler(SecureBlackboxFtpConfiguration configuration)
        {
            serverSsl             = configuration.FtpSsl;
            serverPort            = configuration.FtpPort;
            server                = configuration.FtpRemoteServer;
            username              = configuration.FtpUsername;
            password              = configuration.FtpPassword;
            certificateKey        = configuration.PfxKeyIdentifier;
            certificatePath       = configuration.PfxFileName;
            certificatePassphrase = configuration.PfxPassphrase;

            memoryCertificateStorage = new TElMemoryCertStorage();
            certificate = new TElX509Certificate();
        }
示例#2
0
        public SecureBlackboxFtpHandler(string server, string username, string password, string certificatePath, string certificatePassphrase)
        {
            this.server                = server;
            this.username              = username;
            this.password              = password;
            this.certificatePath       = certificatePath;
            this.certificatePassphrase = certificatePassphrase;

            serverSsl                = true;
            serverPort               = 21;
            certificateKey           = string.Empty;
            memoryCertificateStorage = new TElMemoryCertStorage();
            certificate              = new TElX509Certificate();
        }
示例#3
0
        private TElMemoryCertStorage LoadCertificate(string credentialsID, string access_token)
        {
            //credentialsInfo
            JsonSerializer serializer  = new JsonSerializer();
            ErrorLogger    errorLogger = new ErrorLogger();


            InputCredentialsInfo credentialsInfo = new InputCredentialsInfo()
            {
                credentialID = credentialsID
            };
            CredentialsInfoClient credInfoClient = new CredentialsInfoClient(serializer, errorLogger, baseURL);

            string temp = credInfoClient.GetCredentialsInfo(access_token, credentialsInfo).ToString();

            // string temp = serializer.Serialize(outputCredentials);
            if (!temp.Contains("error") && temp != "")
            {
                OutputCredentialsInfo output = serializer.Deserialize <OutputCredentialsInfo>(temp);

                string certificate = output.cert.certificates.FirstOrDefault();

                TElX509Certificate cert    = new TElX509Certificate();
                byte[]             certBuf = Encoding.UTF8.GetBytes(certificate);
                int r = cert.LoadFromBufferAuto(certBuf, 0, certBuf.Length, "");

                if (r != 0)
                {
                    throw new Exception("Certificate read error: " + r.ToString());
                }

                TElMemoryCertStorage storage = new TElMemoryCertStorage();
                storage.Add(cert, true);

                return(storage);
            }
            else
            {
                return(null);
            }
        }