예제 #1
0
        /// <summary>Sends client SASL negotiation for specialized encrypted handshake.</summary>
        /// <param name="underlyingOut">connection output stream</param>
        /// <param name="underlyingIn">connection input stream</param>
        /// <param name="encryptionKey">for an encrypted SASL handshake</param>
        /// <returns>new pair of streams, wrapped after SASL negotiation</returns>
        /// <exception cref="System.IO.IOException">for any error</exception>
        private IOStreamPair GetEncryptedStreams(OutputStream underlyingOut, InputStream
                                                 underlyingIn, DataEncryptionKey encryptionKey)
        {
            IDictionary <string, string> saslProps = DataTransferSaslUtil.CreateSaslPropertiesForEncryption
                                                         (encryptionKey.encryptionAlgorithm);

            Log.Debug("Client using encryption algorithm {}", encryptionKey.encryptionAlgorithm
                      );
            string userName = GetUserNameFromEncryptionKey(encryptionKey);

            char[] password = DataTransferSaslUtil.EncryptionKeyToPassword(encryptionKey.encryptionKey
                                                                           );
            CallbackHandler callbackHandler = new SaslDataTransferClient.SaslClientCallbackHandler
                                                  (userName, password);

            return(DoSaslHandshake(underlyingOut, underlyingIn, userName, saslProps, callbackHandler
                                   ));
        }
예제 #2
0
 /// <exception cref="System.IO.IOException"/>
 public char[] Apply(string userName)
 {
     return(DataTransferSaslUtil.EncryptionKeyToPassword(this._enclosing.GetEncryptionKeyFromUserName
                                                             (userName)));
 }