Changeset 2273


Ignore:
Timestamp:
Dec 28, 2010, 7:23:32 PM (11 years ago)
Author:
krueger
Message:

This commit repairs CT2 build
Main features:

  • New peer2peer certificate system included
  • P2PEditor Password field added
  • Keysearcher is now using the Avatarname

You will need a certificate to join the peer2peer network

Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypP2P/CrypP2P.csproj

    r2271 r2273  
    7878      <Private>false</Private>
    7979    </Reference>
    80         <Reference Include="CertificateLibrary">
     80    <Reference Include="CertificateLibrary">
    8181      <HintPath>..\appreferences\x86\certificatelibrary.dll</HintPath>
    8282      <Private>false</Private>
     
    144144      <Private>false</Private>
    145145    </Reference>
    146         <Reference Include="CertificateLibrary">
     146    <Reference Include="CertificateLibrary">
    147147      <HintPath>..\appreferences\x64\certificatelibrary.dll</HintPath>
    148148      <Private>false</Private>
     
    227227    <Compile Include="Internal\RequestResultType.cs" />
    228228    <Compile Include="Internal\RequestType.cs" />
     229    <Compile Include="P2PSettings.cs" />
    229230    <Compile Include="P2PSettings.Designer.cs">
    230231      <AutoGen>True</AutoGen>
  • trunk/CrypP2P/Helper/PAPCertificate.cs

    r1616 r2273  
    55using System.IO;
    66using Cryptool.PluginBase;
     7using PeersAtPlay.CertificateLibrary.Certificates;
    78
    89/*
     
    2122        /// registered with this user name.
    2223        /// </summary>
    23         public const string CERTIFIED_PEER_NAME = "CrypTool2"; //"pap0001"; //"CT_PAP_User";
    24         public const string CERTIFICATE_DIRECTORY = "pap_certificates";
     24        //public const string CERTIFIED_PEER_NAME = "CrypTool2"; //"pap0001"; //"CT_PAP_User";
     25        //public const string CERTIFICATE_DIRECTORY = "pap_certificates";
    2526
    2627        private static string sCertPath;
     
    3435            private set
    3536            {
    36                 string combindedCertPath = Path.Combine(value, CERTIFICATE_DIRECTORY);
    37                 if (Directory.Exists(combindedCertPath))
    38                     sCertPath = combindedCertPath;
     37                if (Directory.Exists(value))
     38                    sCertPath = value;
    3939                else
    40                     throw (new DirectoryNotFoundException("Path: " + combindedCertPath + " not found"));
     40                    throw (new DirectoryNotFoundException("Path: " + value + " not found"));
    4141            }
    4242        }
     
    9090        /// be combined internally!!!</param>
    9191        /// <returns></returns>
    92         public static bool CheckAvailabilityAndInstallMissingCertificates(string sPath)
    93         {
    94             List<PAP_Certificates> lstMissingCerts = new List<PAP_Certificates>();
    95             lstMissingCerts = CheckAvailabilityOfPAPCertificates(sPath);
    96             return InstallMissingCertificates(lstMissingCerts, sPath);
    97         }
     92        //public static bool CheckAvailabilityAndInstallMissingCertificates(string sPath)
     93        //{
     94        //    List<PAP_Certificates> lstMissingCerts = new List<PAP_Certificates>();
     95        //    lstMissingCerts = CheckAvailabilityOfPAPCertificates(sPath);
     96        //    return InstallMissingCertificates(lstMissingCerts, sPath);
     97        //}
    9898
    9999        /// <summary>
     
    109109            CertPath = sPath;
    110110            List<PAP_Certificates> retLst = new List<PAP_Certificates>();
    111             X509Certificate2Collection certColl;
     111            //X509Certificate2Collection certColl;
    112112
    113113            /* BEGIN: Checking availablity of the three root certificates */
     
    127127            //    retLst.Add(PAP_Certificates.Opa);
    128128
    129             certColl = FindCertificates(CERT_STORE_ROOT, CERT_STORE_LOCATION,
    130                 PAP_FIND_TYPE, CERT_PAP_SERIAL, true);
    131             if (certColl.Count == 0)
    132                 retLst.Add(PAP_Certificates.Pap);
     129            //certColl = FindCertificates(CERT_STORE_ROOT, CERT_STORE_LOCATION,
     130            //    PAP_FIND_TYPE, CERT_PAP_SERIAL, true);
     131            //if (certColl.Count == 0)
     132            //    retLst.Add(PAP_Certificates.Pap);
    133133            /* END: Checking availablity of the three root certificates */
    134134
    135135            // Check user certificate availability
    136             certColl = FindCertificates(CERT_STORE_USER, CERT_STORE_LOCATION,
    137                 PAP_FIND_TYPE, CERT_USER_SERIAL, true);
    138             if (certColl.Count == 0)
    139                 retLst.Add(PAP_Certificates.User);
     136            //certColl = FindCertificates(CERT_STORE_USER, CERT_STORE_LOCATION,
     137            //    PAP_FIND_TYPE, CERT_USER_SERIAL, true);
     138            //if (certColl.Count == 0)
     139            //    retLst.Add(PAP_Certificates.User);
    140140
    141141            return retLst;
     
    151151        /// be combined internally!!!</param>
    152152        /// <returns></returns>
    153         public static bool InstallMissingCertificates(List<PAP_Certificates> installList, string sPath)
    154         {
    155             bool intermediateResult = true;
    156             bool actualResult = true;
    157 
    158             CertPath = sPath;
    159 
    160             foreach (PAP_Certificates papCert in installList)
    161             {
    162                 switch (papCert)
    163                 {
    164                     case PAP_Certificates.Server_CA:
    165                         intermediateResult = InstallCertificate(CERT_STORE_ROOT, CERT_STORE_LOCATION,
    166                             Path.Combine(CertPath, CERT_SERVER_CA_FILE_NAME), CERT_SERVER_CA_PASSWORD);
    167                         break;
    168                     case PAP_Certificates.Opa:
    169                         intermediateResult = InstallCertificate(CERT_STORE_ROOT, CERT_STORE_LOCATION,
    170                             Path.Combine(CertPath, CERT_OPA_FILE_NAME), CERT_OPA_PASSWORD);
    171                         break;
    172                     case PAP_Certificates.Pap:
    173                         intermediateResult = InstallCertificate(CERT_STORE_ROOT, CERT_STORE_LOCATION,
    174                             Path.Combine(CertPath, CERT_PAP_FILE_NAME), CERT_PAP_PASSWORD);
    175                         break;
    176                     case PAP_Certificates.User:
    177                         intermediateResult = InstallCertificate(CERT_STORE_USER, CERT_STORE_LOCATION,
    178                             Path.Combine(CertPath, CERT_USER_FILE_NAME), CERT_USER_PASSWORD);
    179                         break;
    180                     default:
    181                         break;
    182                 }
    183                 actualResult = actualResult && intermediateResult;
    184             }
    185             return actualResult;
    186         }
     153        //public static bool InstallMissingCertificates(List<PAP_Certificates> installList, string sPath)
     154        //{
     155        //    bool intermediateResult = true;
     156        //    bool actualResult = true;
     157
     158        //    CertPath = sPath;
     159
     160        //    foreach (PAP_Certificates papCert in installList)
     161        //    {
     162        //        switch (papCert)
     163        //        {
     164        //            case PAP_Certificates.Server_CA:
     165        //                intermediateResult = InstallCertificate(CERT_STORE_ROOT, CERT_STORE_LOCATION,
     166        //                    Path.Combine(CertPath, CERT_SERVER_CA_FILE_NAME), CERT_SERVER_CA_PASSWORD);
     167        //                break;
     168        //            case PAP_Certificates.Opa:
     169        //                intermediateResult = InstallCertificate(CERT_STORE_ROOT, CERT_STORE_LOCATION,
     170        //                    Path.Combine(CertPath, CERT_OPA_FILE_NAME), CERT_OPA_PASSWORD);
     171        //                break;
     172        //            case PAP_Certificates.Pap:
     173        //                intermediateResult = InstallCertificate(CERT_STORE_ROOT, CERT_STORE_LOCATION,
     174        //                    Path.Combine(CertPath, CERT_PAP_FILE_NAME), CERT_PAP_PASSWORD);
     175        //                break;
     176        //            case PAP_Certificates.User:
     177        //                intermediateResult = InstallCertificate(CERT_STORE_USER, CERT_STORE_LOCATION,
     178        //                    Path.Combine(CertPath, CERT_USER_FILE_NAME), CERT_USER_PASSWORD);
     179        //                break;
     180        //            default:
     181        //                break;
     182        //        }
     183        //        actualResult = actualResult && intermediateResult;
     184        //    }
     185        //    return actualResult;
     186        //}
    187187
    188188        #endregion
     
    199199        /// <param name="onlyValidCerts">only valid certificates (not outdated, revocated, etc.) will be considered.</param>
    200200        /// <returns>a list of all certificates, who satisfy the search attributes</returns>
    201         private static X509Certificate2Collection FindCertificates(StoreName storeName, StoreLocation storeLocation, X509FindType findType, object findValue, bool onlyValidCerts)
    202         {
    203             X509Certificate2Collection findedCertCol = null;
    204             X509Store store = new X509Store(storeName, storeLocation);
    205             try
    206             {
    207                 store.Open(OpenFlags.ReadOnly);
    208                 findedCertCol = store.Certificates.Find(findType, findValue, onlyValidCerts);
    209             }
    210             catch (Exception)
    211             {
    212 
    213                 throw;
    214             }
    215             finally
    216             {
    217                 store.Close();
    218             }
    219 
    220             return findedCertCol;
    221         }
     201        //private static X509Certificate2Collection FindCertificates(StoreName storeName, StoreLocation storeLocation, X509FindType findType, object findValue, bool onlyValidCerts)
     202        //{
     203        //    X509Certificate2Collection findedCertCol = null;
     204        //    X509Store store = new X509Store(storeName, storeLocation);
     205        //    try
     206        //    {
     207        //        store.Open(OpenFlags.ReadOnly);
     208        //        findedCertCol = store.Certificates.Find(findType, findValue, onlyValidCerts);
     209        //    }
     210        //    catch (Exception)
     211        //    {
     212
     213        //        throw;
     214        //    }
     215        //    finally
     216        //    {
     217        //        store.Close();
     218        //    }
     219
     220        //    return findedCertCol;
     221        //}
    222222
    223223        /// <summary>
     
    228228        /// <param name="sCertPath">Whole certification path and filename</param>
    229229        /// <param name="sCertPassword">if necessary, you have to declare a password. Otherwise use ""</param>
    230         private static bool InstallCertificate(StoreName storeName, StoreLocation storeLocation, string sCertPath, string sCertPassword)
    231         {
    232             bool ret = false;
    233 
    234             if (File.Exists(sCertPath))
    235             {
    236                 X509Store store = new X509Store(storeName, storeLocation);
    237                 try
    238                 {
    239                     /* Verification of certifates failed every time - no idea why */
    240                     //if (cert.Verify())
    241                     //{
    242                     X509Certificate2 cert = new X509Certificate2(sCertPath, sCertPassword);
    243                     store.Open(OpenFlags.ReadWrite);
    244                     store.Add(cert);
    245                     store.Close();
    246                     ret = true;
    247                     //}
    248                     //else
    249                     //{
    250                     //    throw (new Exception("Installing Certificate " + cert.SubjectName.Name + " wasn't possible, because Certificate isn't valid anymore"));
    251                     //}
    252                 }
    253                 catch (Exception ex)
    254                 {
    255                     throw (new Exception("Installation of " + sCertPath + " certificate wasn't possible", ex));
    256                 }
    257                 finally
    258                 {
    259                     store.Close();
    260                 }
    261             }
    262             return ret;
    263         }
     230        //private static bool InstallCertificate(StoreName storeName, StoreLocation storeLocation, string sCertPath, string sCertPassword)
     231        //{
     232        //    bool ret = false;
     233
     234        //    if (File.Exists(sCertPath))
     235        //    {
     236        //        X509Store store = new X509Store(storeName, storeLocation);
     237        //        try
     238        //        {
     239        //            /* Verification of certifates failed every time - no idea why */
     240        //            //if (cert.Verify())
     241        //            //{
     242        //            X509Certificate2 cert = new X509Certificate2(sCertPath, sCertPassword);
     243        //            store.Open(OpenFlags.ReadWrite);
     244        //            store.Add(cert);
     245        //            store.Close();
     246        //            ret = true;
     247        //            //}
     248        //            //else
     249        //            //{
     250        //            //    throw (new Exception("Installing Certificate " + cert.SubjectName.Name + " wasn't possible, because Certificate isn't valid anymore"));
     251        //            //}
     252        //        }
     253        //        catch (Exception ex)
     254        //        {
     255        //            throw (new Exception("Installation of " + sCertPath + " certificate wasn't possible", ex));
     256        //        }
     257        //        finally
     258        //        {
     259        //            store.Close();
     260        //        }
     261        //    }
     262        //    return ret;
     263        //}
    264264
    265265        #endregion
     
    271271        /// </summary>
    272272        /// <returns>The root certificate or null on error</returns>
    273         public static X509Certificate2Collection getRootCertificate()
    274         {
    275             X509Certificate2Collection root = FindCertificates(CERT_STORE_ROOT, CERT_STORE_LOCATION, X509FindType.FindBySerialNumber, CERT_PAP_SERIAL, true);
    276             return root;
    277         }
     273        //public static X509Certificate2Collection getRootCertificate()
     274        //{
     275        //    //X509Certificate2Collection root = FindCertificates(CERT_STORE_ROOT, CERT_STORE_LOCATION, X509FindType.FindBySerialNumber, CERT_PAP_SERIAL, true);
     276           
     277        //    return new X509Certificate2Collection(new X509Certificate2(CertificateServices.CaCertificate));
     278        //}
    278279
    279280        /// <summary>
     
    282283        /// <param name="email">the email</param>
    283284        /// <returns>the searched certificate</returns>
    284         public static X509Certificate2 GetCertificateWithMail(String email)
    285         {
    286             try
    287             {
    288                 String fileName = GetHash(email);
    289                 X509Certificate2Collection col = FindCertificates(StoreName.My, StoreLocation.CurrentUser, X509FindType.FindByIssuerName, CERT_PAP_ISSUER, true);
    290                 foreach (X509Certificate2 cert in col)
    291                 {
    292                     if (cert.Subject.Contains(fileName))
    293                     {
    294                         return cert;
    295                     }
    296                 }
    297                 return null;
    298             }
    299             catch
    300             {
    301                 return null;
    302             }
    303         }
     285        //public static X509Certificate2 GetCertificateWithMail(String email)
     286        //{
     287        //    try
     288        //    {
     289        //        return new X509Certificate2(CertificateServices.ConvertToDotNet(CertificateServices.GetX509CertificateByEmail(PeerCertificate.DEFAULT_USER_CERTIFICATE_DIRECTORY, email)));
     290        //        //String fileName = GetHash(email);
     291        //        //X509Certificate2Collection col = FindCertificates(StoreName.My, StoreLocation.CurrentUser, X509FindType.FindByIssuerName, CERT_PAP_ISSUER, true);
     292        //        //foreach (X509Certificate2 cert in col)
     293        //        //{
     294        //        //    if (cert.Subject.Contains(fileName))
     295        //        //    {
     296        //        //        return cert;
     297        //        //    }
     298        //        //}
     299        //        //return null;
     300        //    }
     301        //    catch
     302        //    {
     303        //        return null;
     304        //    }
     305        //}
    304306
    305307        /// <summary>
     
    308310        /// <param name="str">the ordinary string</param>
    309311        /// <returns>an coded string</returns>
    310         public static String GetHash(String str)
    311         {
    312             str = str.ToLower();
    313             System.Security.Cryptography.SHA1 sec = new System.Security.Cryptography.SHA1CryptoServiceProvider();
    314             Encoding encoding = Encoding.Unicode;
    315             byte[] insertion = encoding.GetBytes(str);
    316             byte[] hash = sec.ComputeHash(insertion);
    317             String result = BitConverter.ToString(hash);//Convert.ToBase64String(hash);
    318             result = result.Substring(result.Length / 2 + 1);
    319             return result;
    320         }
     312        //public static String GetHash(String str)
     313        //{
     314        //    str = str.ToLower();
     315        //    System.Security.Cryptography.SHA1 sec = new System.Security.Cryptography.SHA1CryptoServiceProvider();
     316        //    Encoding encoding = Encoding.Unicode;
     317        //    byte[] insertion = encoding.GetBytes(str);
     318        //    byte[] hash = sec.ComputeHash(insertion);
     319        //    String result = BitConverter.ToString(hash);//Convert.ToBase64String(hash);
     320        //    result = result.Substring(result.Length / 2 + 1);
     321        //    return result;
     322        //}
    321323
    322324        #endregion
     
    328330        /// <param name="location">The location</param>
    329331        /// <param name="name">The store name</param>
    330         public static void PickCertificate(StoreLocation location, StoreName name)
    331         {
    332             X509Certificate2 MyCertificate;
    333             X509Store store = new X509Store(name, location);
    334             try
    335             {
    336                 store.Open(OpenFlags.ReadOnly);
    337 
    338                 // Pick a certificate from the store
    339                 MyCertificate = X509Certificate2UI.SelectFromCollection(store.Certificates, "P@P certificates", "Please select your certificate", X509SelectionFlag.SingleSelection)[0];
    340 
    341                 // Comment next line to enable selection of an invalid certificate
    342                 ValidateCert(MyCertificate);
    343 
    344                 //MyCertificateSerialNumber = MyCertificate.SerialNumber;
    345             }
    346             catch (Exception ex)
    347             {
    348                 MyCertificate = null;
    349                 throw (new Exception("Certificate not valid", ex));
    350             }
    351             finally { store.Close(); }
    352         }
     332        //public static void PickCertificate(StoreLocation location, StoreName name)
     333        //{
     334        //    X509Certificate2 MyCertificate;
     335        //    X509Store store = new X509Store(name, location);
     336        //    try
     337        //    {
     338        //        store.Open(OpenFlags.ReadOnly);
     339
     340        //        // Pick a certificate from the store
     341        //        MyCertificate = X509Certificate2UI.SelectFromCollection(store.Certificates, "P@P certificates", "Please select your certificate", X509SelectionFlag.SingleSelection)[0];
     342
     343        //        // Comment next line to enable selection of an invalid certificate
     344        //        ValidateCert(MyCertificate);
     345
     346        //        //MyCertificateSerialNumber = MyCertificate.SerialNumber;
     347        //    }
     348        //    catch (Exception ex)
     349        //    {
     350        //        MyCertificate = null;
     351        //        throw (new Exception("Certificate not valid", ex));
     352        //    }
     353        //    finally { store.Close(); }
     354        //}
    353355        #endregion
    354356
     
    360362        /// <exception cref="ArgumentNullException"></exception>
    361363        /// <param name="cert">Certificate to validate</param>
    362         public static void ValidateCert(X509Certificate2 cert)
    363         {
    364             if (cert == null)
    365             {
    366                 throw new ArgumentNullException("cert");
    367             }
    368 
    369             X509Chain chain = new X509Chain();
    370 
    371             // check entire chain for revocation
    372             chain.ChainPolicy.RevocationFlag = X509RevocationFlag.EntireChain;
    373 
    374             // TODO: Check Online
    375             chain.ChainPolicy.RevocationMode = X509RevocationMode.NoCheck;
    376 
    377             // timeout for online revocation list
    378             chain.ChainPolicy.UrlRetrievalTimeout = new TimeSpan(0, 0, 30);
    379 
    380             // TODO: Revocation unknown allowed
    381             chain.ChainPolicy.VerificationFlags = X509VerificationFlags.NoFlag;
    382 
    383             // Check chain
    384             chain.Build(cert);
    385 
    386             // If there was an error or no root CA is given throw exception
    387             if (chain.ChainStatus.Length != 0 || chain.ChainElements.Count != 2)
    388             {
    389                 throw new Exception("Certificates chain not valid!");
    390             }
    391 
    392             // Check root certificate
    393             if (chain.ChainElements[1].Certificate.SerialNumber.ToLower() != CERT_PAP_SERIAL.ToLower())
    394             {
    395                 throw new Exception("Certificates root CA not valid!");
    396             }
    397         }
     364        //public static void ValidateCert(X509Certificate2 cert)
     365        //{
     366        //    if (cert == null)
     367        //    {
     368        //        throw new ArgumentNullException("cert");
     369        //    }
     370
     371        //    X509Chain chain = new X509Chain();
     372
     373        //    // check entire chain for revocation
     374        //    chain.ChainPolicy.RevocationFlag = X509RevocationFlag.EntireChain;
     375
     376        //    // TODO: Check Online
     377        //    chain.ChainPolicy.RevocationMode = X509RevocationMode.NoCheck;
     378
     379        //    // timeout for online revocation list
     380        //    chain.ChainPolicy.UrlRetrievalTimeout = new TimeSpan(0, 0, 30);
     381
     382        //    // TODO: Revocation unknown allowed
     383        //    chain.ChainPolicy.VerificationFlags = X509VerificationFlags.NoFlag;
     384
     385        //    // Check chain
     386        //    chain.Build(cert);
     387
     388        //    // If there was an error or no root CA is given throw exception
     389        //    if (chain.ChainStatus.Length != 0 || chain.ChainElements.Count != 2)
     390        //    {
     391        //        throw new Exception("Certificates chain not valid!");
     392        //    }
     393
     394        //    // Check root certificate
     395        //    if (chain.ChainElements[1].Certificate.SerialNumber.ToLower() != CERT_PAP_SERIAL.ToLower())
     396        //    {
     397        //        throw new Exception("Certificates root CA not valid!");
     398        //    }
     399        //}
    398400        #endregion
    399401
     
    411413
    412414            // get exe directory, because there resides the certificate directory
    413             System.Reflection.Assembly assemb = System.Reflection.Assembly.GetEntryAssembly();
    414             string applicationDir = System.IO.Path.GetDirectoryName(assemb.Location);
     415            //System.Reflection.Assembly assemb = System.Reflection.Assembly.GetEntryAssembly();
     416            //string applicationDir = System.IO.Path.GetDirectoryName(assemb.Location);
    415417            // check if all necessary certs are installed
    416418            P2PManager.GuiLogMessage("Validating installation of P2P certificates.", NotificationLevel.Info);
    417             List<PAPCertificate.PAP_Certificates> lstMissingCerts = PAPCertificate.CheckAvailabilityOfPAPCertificates(applicationDir);
     419            List<PAPCertificate.PAP_Certificates> lstMissingCerts = PAPCertificate.CheckAvailabilityOfPAPCertificates(PeerCertificate.DEFAULT_USER_CERTIFICATE_DIRECTORY);
    418420            if (lstMissingCerts.Count == 0)
    419421            {
    420                 //GuiLogMessage("All neccessary p2p certificates are installed.", NotificationLevel.Info);
     422                P2PManager.GuiLogMessage("All neccessary p2p certificates are installed.", NotificationLevel.Info);
    421423                retValue = true;
    422424            }
    423             else
    424             {
    425                 StringBuilder sbMissingCerts = new StringBuilder();
    426                 for (int i = 0; i < lstMissingCerts.Count; i++)
    427                 {
    428                     sbMissingCerts.AppendLine(Enum.GetName(typeof(PAPCertificate.PAP_Certificates), lstMissingCerts[i]));
    429                 }
    430                 P2PManager.GuiLogMessage("Following certificates are missing. They will be installed now.\n" + sbMissingCerts.ToString(), NotificationLevel.Info);
    431 
    432                 // try/catch neccessary because the CT-Editor doesn't support the whole exception display process (e.g. shows only "unknown error.")
    433                 try
    434                 {
    435                     if (PAPCertificate.InstallMissingCertificates(lstMissingCerts, applicationDir))
    436                     {
    437                         P2PManager.GuiLogMessage("Installation of all missing certificates was successful.", NotificationLevel.Info);
    438                         retValue = true;
    439                     }
    440                     else
    441                     {
    442                         P2PManager.GuiLogMessage("No/not all missing certificates were installed successful.", NotificationLevel.Error);
    443                     }
    444                 }
    445                 catch (Exception ex)
    446                 {
    447                     P2PManager.GuiLogMessage("Error occured while installing certificates. Exception: " + ex.ToString(), NotificationLevel.Error);
    448                 }
    449             }
     425            //else
     426            //{
     427            //    StringBuilder sbMissingCerts = new StringBuilder();
     428            //    for (int i = 0; i < lstMissingCerts.Count; i++)
     429            //    {
     430            //        sbMissingCerts.AppendLine(Enum.GetName(typeof(PAPCertificate.PAP_Certificates), lstMissingCerts[i]));
     431            //    }
     432            //    P2PManager.GuiLogMessage("Following certificates are missing. They will be installed now.\n" + sbMissingCerts.ToString(), NotificationLevel.Info);
     433
     434            //    // try/catch neccessary because the CT-Editor doesn't support the whole exception display process (e.g. shows only "unknown error.")
     435            //    try
     436            //    {
     437            //        if (PAPCertificate.InstallMissingCertificates(lstMissingCerts, applicationDir))
     438            //        {
     439            //            P2PManager.GuiLogMessage("Installation of all missing certificates was successful.", NotificationLevel.Info);
     440            //            retValue = true;
     441            //        }
     442            //        else
     443            //        {
     444            //            P2PManager.GuiLogMessage("No/not all missing certificates were installed successful.", NotificationLevel.Error);
     445            //        }
     446            //    }
     447            //    catch (Exception ex)
     448            //    {
     449            //        P2PManager.GuiLogMessage("Error occured while installing certificates. Exception: " + ex.ToString(), NotificationLevel.Error);
     450            //    }
     451            //}
    450452            return retValue;
    451453        }
  • trunk/CrypP2P/Internal/P2PBase.cs

    r2269 r2273  
    204204                                        NotificationLevel.Info);
    205205            IsInitialized = true;
    206             Dht.Initialize(P2PSettings.Default.PeerName, string.Empty, P2PSettings.Default.WorldName, overlay,
     206            Dht.Initialize(P2PSettings.Default.PeerName, P2PSettings.Default.Password, P2PSettings.Default.WorldName, overlay,
    207207                           bootstrapper, linkmanager, null);
    208208        }
  • trunk/CrypP2P/P2PSettings.Designer.cs

    r2269 r2273  
    11//------------------------------------------------------------------------------
    22// <auto-generated>
    3 //     This code was generated by a tool.
    4 //     Runtime Version:4.0.30319.1
     3//     Dieser Code wurde von einem Tool generiert.
     4//     Laufzeitversion:4.0.30319.1
    55//
    6 //     Changes to this file may cause incorrect behavior and will be lost if
    7 //     the code is regenerated.
     6//     Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
     7//     der Code erneut generiert wird.
    88// </auto-generated>
    99//------------------------------------------------------------------------------
     
    4545            set {
    4646                this["WorldName"] = value;
     47            }
     48        }
     49
     50        [global::System.Configuration.UserScopedSettingAttribute()]
     51        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
     52        [global::System.Configuration.DefaultSettingValueAttribute("")]
     53        public string Password
     54        {
     55            get
     56            {
     57                return ((string)(this["Password"]));
     58            }
     59            set
     60            {
     61                this["Password"] = value;
    4762            }
    4863        }
  • trunk/CrypP2P/P2PSettings.settings

    r2269 r2273  
    4242      <Value Profile="(Default)">paps.vs.uni-due.de</Value>
    4343    </Setting>
     44    <Setting Name="Password" Type="System.String" Scope="User">
     45      <Value Profile="(Default)" />
     46    </Setting>
    4447  </Settings>
    4548</SettingsFile>
  • trunk/CrypP2P/app.config

    r2269 r2273  
    4747                <value>paps.vs.uni-due.de</value>
    4848            </setting>
     49            <setting name="Password" serializeAs="String">
     50                <value />
     51            </setting>
    4952        </Cryptool.P2P.P2PSettings>
    5053    </userSettings>
  • trunk/CrypPlugins/KeySearcher/P2P/Tree/NodeBase.cs

    r2233 r2273  
    2323        public LinkedList<KeySearcher.ValueKey> Result;
    2424
    25         //Dictionary Tests
    26         public String Avatarname = "CrypTool2";
     25        //Dictionary Tests       
     26        //public String Avatarname = "CrypTool2";
     27        public String Avatarname = P2PSettings.Default.PeerName;
     28       
    2729        public Dictionary<String, Dictionary<long, Information>> Activity;
    2830        protected bool integrated;
  • trunk/CrypPlugins/P2PEditor/P2PEditorSettings.cs

    r2269 r2273  
    9292        }
    9393
    94         [TaskPane("worldname_caption", "worldname_tooltip", null, 1, false, DisplayLevel.Beginner, ControlType.TextBox)]
     94        [TaskPane("password_caption",
     95            "password_tooltip"
     96            , null, 1, false, DisplayLevel.Beginner, ControlType.TextBoxHidden)]
     97        public string Password
     98        {
     99            get { return settings.Password; }
     100            set
     101            {
     102                if (value != settings.Password)
     103                {
     104                    settings.Password = value;
     105                    OnPropertyChanged("Password");
     106                    HasChanges = true;
     107                }
     108            }
     109        }
     110
     111        [TaskPane("worldname_caption", "worldname_tooltip", null, 2, false, DisplayLevel.Beginner, ControlType.TextBox)]
    95112        public string WorldName
    96113        {
     
    108125
    109126        // TODO New ControlType needed to choose dialogs? OpenFileDialog not fitting.
    110         [TaskPane("workspacePath_caption", "workspacePath_tooltip", null, 2, true, DisplayLevel.Beginner, ControlType.TextBox)]
     127        [TaskPane("workspacePath_caption", "workspacePath_tooltip", null, 3, true, DisplayLevel.Beginner, ControlType.TextBox)]
    111128        public string WorkspacePath
    112129        {
  • trunk/CrypPlugins/P2PEditor/Resources/Attributes.Designer.cs

    r1914 r2273  
    11//------------------------------------------------------------------------------
    22// <auto-generated>
    3 //     This code was generated by a tool.
    4 //     Runtime Version:4.0.30319.1
     3//     Dieser Code wurde von einem Tool generiert.
     4//     Laufzeitversion:4.0.30319.1
    55//
    6 //     Changes to this file may cause incorrect behavior and will be lost if
    7 //     the code is regenerated.
     6//     Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
     7//     der Code erneut generiert wird.
    88// </auto-generated>
    99//------------------------------------------------------------------------------
     
    1414   
    1515    /// <summary>
    16     ///   A strongly-typed resource class, for looking up localized strings, etc.
     16    ///   Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
    1717    /// </summary>
    18     // This class was auto-generated by the StronglyTypedResourceBuilder
    19     // class via a tool like ResGen or Visual Studio.
    20     // To add or remove a member, edit your .ResX file then rerun ResGen
    21     // with the /str option, or rebuild your VS project.
     18    // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
     19    // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
     20    // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
     21    // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
    2222    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
    2323    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
     
    3434       
    3535        /// <summary>
    36         ///   Returns the cached ResourceManager instance used by this class.
     36        ///   Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
    3737        /// </summary>
    3838        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
     
    4848       
    4949        /// <summary>
    50         ///   Overrides the current thread's CurrentUICulture property for all
    51         ///   resource lookups using this strongly typed resource class.
     50        ///   Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
     51        ///   Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
    5252        /// </summary>
    5353        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
     
    6262       
    6363        /// <summary>
    64         ///   Looks up a localized string similar to Architecture.
     64        ///   Sucht eine lokalisierte Zeichenfolge, die Architecture ähnelt.
    6565        /// </summary>
    6666        internal static string architecture_caption {
     
    7171       
    7272        /// <summary>
    73         ///   Looks up a localized string similar to Architecture of the P2P network..
     73        ///   Sucht eine lokalisierte Zeichenfolge, die Architecture of the P2P network. ähnelt.
    7474        /// </summary>
    7575        internal static string architecture_tooltip {
     
    8080       
    8181        /// <summary>
    82         ///   Looks up a localized string similar to Bootstrapper type.
     82        ///   Sucht eine lokalisierte Zeichenfolge, die Bootstrapper type ähnelt.
    8383        /// </summary>
    8484        internal static string bootstrapper_caption {
     
    8989       
    9090        /// <summary>
    91         ///   Looks up a localized string similar to Bootstrappe type.
     91        ///   Sucht eine lokalisierte Zeichenfolge, die Bootstrappe type ähnelt.
    9292        /// </summary>
    9393        internal static string bootstrapper_tooltip {
     
    9898       
    9999        /// <summary>
    100         ///   Looks up a localized string similar to Connect on startup.
     100        ///   Sucht eine lokalisierte Zeichenfolge, die Connect on startup ähnelt.
    101101        /// </summary>
    102102        internal static string connectOnStartup_caption {
     
    107107       
    108108        /// <summary>
    109         ///   Looks up a localized string similar to Job list refresh interval (seconds).
     109        ///   Sucht eine lokalisierte Zeichenfolge, die Job list refresh interval (seconds) ähnelt.
    110110        /// </summary>
    111111        internal static string distributedJobListRefreshInterval_caption {
     
    116116       
    117117        /// <summary>
    118         ///   Looks up a localized string similar to Refreshes the the distributed job list in the given interval. A value of 0 will disable the automated process..
     118        ///   Sucht eine lokalisierte Zeichenfolge, die Refreshes the the distributed job list in the given interval. A value of 0 will disable the automated process. ähnelt.
    119119        /// </summary>
    120120        internal static string distributedJobListRefreshInterval_tooltip {
     
    125125       
    126126        /// <summary>
    127         ///   Looks up a localized string similar to Experienced settings.
     127        ///   Sucht eine lokalisierte Zeichenfolge, die Experienced settings ähnelt.
    128128        /// </summary>
    129129        internal static string experienced_settings {
     
    134134       
    135135        /// <summary>
    136         ///   Looks up a localized string similar to Expert settings.
     136        ///   Sucht eine lokalisierte Zeichenfolge, die Expert settings ähnelt.
    137137        /// </summary>
    138138        internal static string expert_settings {
     
    143143       
    144144        /// <summary>
    145         ///   Looks up a localized string similar to Link manager type.
     145        ///   Sucht eine lokalisierte Zeichenfolge, die Link manager type ähnelt.
    146146        /// </summary>
    147147        internal static string linkmanager_caption {
     
    152152       
    153153        /// <summary>
    154         ///   Looks up a localized string similar to Link manager type.
     154        ///   Sucht eine lokalisierte Zeichenfolge, die Link manager type ähnelt.
    155155        /// </summary>
    156156        internal static string linkmanager_tooltip {
     
    161161       
    162162        /// <summary>
    163         ///   Looks up a localized string similar to Local port.
     163        ///   Sucht eine lokalisierte Zeichenfolge, die Local port ähnelt.
    164164        /// </summary>
    165165        internal static string localPort_caption {
     
    170170       
    171171        /// <summary>
    172         ///   Looks up a localized string similar to Local port used by the framework. If set to 0, the framework will choose a random port..
     172        ///   Sucht eine lokalisierte Zeichenfolge, die Local port used by the framework. If set to 0, the framework will choose a random port. ähnelt.
    173173        /// </summary>
    174174        internal static string localPort_tooltip {
     
    179179       
    180180        /// <summary>
    181         ///   Looks up a localized string similar to Log connection state.
     181        ///   Sucht eine lokalisierte Zeichenfolge, die Log connection state ähnelt.
    182182        /// </summary>
    183183        internal static string log_connection_state_caption {
     
    188188       
    189189        /// <summary>
    190         ///   Looks up a localized string similar to Logs connection state to the GUI log. For debugging only..
     190        ///   Sucht eine lokalisierte Zeichenfolge, die Logs connection state to the GUI log. For debugging only. ähnelt.
    191191        /// </summary>
    192192        internal static string log_connection_state_tooltip {
     
    197197       
    198198        /// <summary>
    199         ///   Looks up a localized string similar to Syslog.
     199        ///   Sucht eine lokalisierte Zeichenfolge, die Syslog ähnelt.
    200200        /// </summary>
    201201        internal static string log2monitor_caption {
     
    206206       
    207207        /// <summary>
    208         ///   Looks up a localized string similar to Log peer-to-peer related messages to a local syslog daemon running on port 514..
     208        ///   Sucht eine lokalisierte Zeichenfolge, die Log peer-to-peer related messages to a local syslog daemon running on port 514. ähnelt.
    209209        /// </summary>
    210210        internal static string log2monitor_tooltip {
     
    215215       
    216216        /// <summary>
    217         ///   Looks up a localized string similar to Establish a connection to the peer-to-peer network during CrypTool startup..
     217        ///   Sucht eine lokalisierte Zeichenfolge, die Establish a connection to the peer-to-peer network during CrypTool startup. ähnelt.
    218218        /// </summary>
    219219        internal static string onnectOnStartup_tooltip {
     
    224224       
    225225        /// <summary>
    226         ///   Looks up a localized string similar to Server.
     226        ///   Sucht eine lokalisierte Zeichenfolge, die Password ähnelt.
     227        /// </summary>
     228        internal static string password_caption {
     229            get {
     230                return ResourceManager.GetString("password_caption", resourceCulture);
     231            }
     232        }
     233       
     234        /// <summary>
     235        ///   Sucht eine lokalisierte Zeichenfolge, die Password of your Peers@Play certificate ähnelt.
     236        /// </summary>
     237        internal static string password_tooltip {
     238            get {
     239                return ResourceManager.GetString("password_tooltip", resourceCulture);
     240            }
     241        }
     242       
     243        /// <summary>
     244        ///   Sucht eine lokalisierte Zeichenfolge, die Server ähnelt.
    227245        /// </summary>
    228246        internal static string server_settings {
     
    233251       
    234252        /// <summary>
    235         ///   Looks up a localized string similar to Host.
     253        ///   Sucht eine lokalisierte Zeichenfolge, die Host ähnelt.
    236254        /// </summary>
    237255        internal static string serverHost_caption {
     
    242260       
    243261        /// <summary>
    244         ///   Looks up a localized string similar to Host of the central p2p server..
     262        ///   Sucht eine lokalisierte Zeichenfolge, die Host of the central p2p server. ähnelt.
    245263        /// </summary>
    246264        internal static string serverHost_tooltip {
     
    251269       
    252270        /// <summary>
    253         ///   Looks up a localized string similar to Port.
     271        ///   Sucht eine lokalisierte Zeichenfolge, die Port ähnelt.
    254272        /// </summary>
    255273        internal static string serverPort_caption {
     
    260278       
    261279        /// <summary>
    262         ///   Looks up a localized string similar to Post of the central p2p server..
     280        ///   Sucht eine lokalisierte Zeichenfolge, die Post of the central p2p server. ähnelt.
    263281        /// </summary>
    264282        internal static string serverPort_tooltip {
     
    269287       
    270288        /// <summary>
    271         ///   Looks up a localized string similar to Connect.
     289        ///   Sucht eine lokalisierte Zeichenfolge, die Connect ähnelt.
    272290        /// </summary>
    273291        internal static string start_caption {
     
    278296       
    279297        /// <summary>
    280         ///   Looks up a localized string similar to Cannot connect to the P2P network. You are already connected or a connection attempt is in progress..
     298        ///   Sucht eine lokalisierte Zeichenfolge, die Cannot connect to the P2P network. You are already connected or a connection attempt is in progress. ähnelt.
    281299        /// </summary>
    282300        internal static string start_failed {
     
    287305       
    288306        /// <summary>
    289         ///   Looks up a localized string similar to Connection to the P2P network will be established in the background..
     307        ///   Sucht eine lokalisierte Zeichenfolge, die Connection to the P2P network will be established in the background. ähnelt.
    290308        /// </summary>
    291309        internal static string start_launched {
     
    296314       
    297315        /// <summary>
    298         ///   Looks up a localized string similar to Connect to the P2P network..
     316        ///   Sucht eine lokalisierte Zeichenfolge, die Connect to the P2P network. ähnelt.
    299317        /// </summary>
    300318        internal static string start_tooltip {
     
    305323       
    306324        /// <summary>
    307         ///   Looks up a localized string similar to Disconnect.
     325        ///   Sucht eine lokalisierte Zeichenfolge, die Disconnect ähnelt.
    308326        /// </summary>
    309327        internal static string stop_caption {
     
    314332       
    315333        /// <summary>
    316         ///   Looks up a localized string similar to Cannot disconnect from the P2P network. You are not connected or a connection attempt is in progress..
     334        ///   Sucht eine lokalisierte Zeichenfolge, die Cannot disconnect from the P2P network. You are not connected or a connection attempt is in progress. ähnelt.
    317335        /// </summary>
    318336        internal static string stop_failed {
     
    323341       
    324342        /// <summary>
    325         ///   Looks up a localized string similar to Disconnecting from the P2P network..
     343        ///   Sucht eine lokalisierte Zeichenfolge, die Disconnecting from the P2P network. ähnelt.
    326344        /// </summary>
    327345        internal static string stop_launched {
     
    332350       
    333351        /// <summary>
    334         ///   Looks up a localized string similar to Disconnect from P2P network..
     352        ///   Sucht eine lokalisierte Zeichenfolge, die Disconnect from P2P network. ähnelt.
    335353        /// </summary>
    336354        internal static string stop_tooltip {
     
    341359       
    342360        /// <summary>
    343         ///   Looks up a localized string similar to Transport protocol.
     361        ///   Sucht eine lokalisierte Zeichenfolge, die Transport protocol ähnelt.
    344362        /// </summary>
    345363        internal static string transportprotocol_caption {
     
    350368       
    351369        /// <summary>
    352         ///   Looks up a localized string similar to Transport protocol to use..
     370        ///   Sucht eine lokalisierte Zeichenfolge, die Transport protocol to use. ähnelt.
    353371        /// </summary>
    354372        internal static string transportprotocol_tooltip {
     
    359377       
    360378        /// <summary>
    361         ///   Looks up a localized string similar to Use local port address detection.
     379        ///   Sucht eine lokalisierte Zeichenfolge, die Use local port address detection ähnelt.
    362380        /// </summary>
    363381        internal static string useLocalAddressDetection_caption {
     
    368386       
    369387        /// <summary>
    370         ///   Looks up a localized string similar to Setting for nodes, where the internal and external adresses match..
     388        ///   Sucht eine lokalisierte Zeichenfolge, die Setting for nodes, where the internal and external adresses match. ähnelt.
    371389        /// </summary>
    372390        internal static string useLocalAddressDetection_tooltip {
     
    377395       
    378396        /// <summary>
    379         ///   Looks up a localized string similar to Username.
     397        ///   Sucht eine lokalisierte Zeichenfolge, die Username ähnelt.
    380398        /// </summary>
    381399        internal static string username_caption {
     
    386404       
    387405        /// <summary>
    388         ///   Looks up a localized string similar to Uusername for the peer-to-peer system. If this value is changed, CrypTool will ask for a certificate the first time the new name is used. When in doubt, leave the default name &quot;CrypTool2&quot;..
     406        ///   Sucht eine lokalisierte Zeichenfolge, die Uusername for the peer-to-peer system. If this value is changed, CrypTool will ask for a certificate the first time the new name is used. When in doubt, leave the default name &quot;CrypTool2&quot;. ähnelt.
    389407        /// </summary>
    390408        internal static string username_tooltip {
     
    395413       
    396414        /// <summary>
    397         ///   Looks up a localized string similar to Local workspace directory.
     415        ///   Sucht eine lokalisierte Zeichenfolge, die Local workspace directory ähnelt.
    398416        /// </summary>
    399417        internal static string workspacePath_caption {
     
    404422       
    405423        /// <summary>
    406         ///   Looks up a localized string similar to Directory in where workspaces you participate in are saved..
     424        ///   Sucht eine lokalisierte Zeichenfolge, die Directory in where workspaces you participate in are saved. ähnelt.
    407425        /// </summary>
    408426        internal static string workspacePath_tooltip {
     
    413431       
    414432        /// <summary>
    415         ///   Looks up a localized string similar to World name.
     433        ///   Sucht eine lokalisierte Zeichenfolge, die World name ähnelt.
    416434        /// </summary>
    417435        internal static string worldname_caption {
     
    422440       
    423441        /// <summary>
    424         ///   Looks up a localized string similar to Name of the world in the peer-to-peer system..
     442        ///   Sucht eine lokalisierte Zeichenfolge, die Name of the world in the peer-to-peer system. ähnelt.
    425443        /// </summary>
    426444        internal static string worldname_tooltip {
  • trunk/CrypPlugins/P2PEditor/Resources/Attributes.resx

    r1914 r2273  
    172172    <value>Establish a connection to the peer-to-peer network during CrypTool startup.</value>
    173173  </data>
     174  <data name="password_caption" xml:space="preserve">
     175    <value>Password</value>
     176  </data>
     177  <data name="password_tooltip" xml:space="preserve">
     178    <value>Password of your Peers@Play certificate</value>
     179  </data>
    174180  <data name="serverHost_caption" xml:space="preserve">
    175181    <value>Host</value>
Note: See TracChangeset for help on using the changeset viewer.