bakaid commented on a change in pull request #558: MINIFICPP-542 - Add PutSFTP 
processor
URL: https://github.com/apache/nifi-minifi-cpp/pull/558#discussion_r285557038
 
 

 ##########
 File path: 
extensions/sftp/tests/tools/sftp-test-server/src/main/java/InsecureRandom.java
 ##########
 @@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.Random;
+
+import org.apache.sshd.common.random.AbstractRandom;
+
+public class InsecureRandom extends AbstractRandom {
 
 Review comment:
   It does implement both interfaces, but it is just a wrapper for another 
random factory, it does not in itself implement random generation 
(https://github.com/apache/mina-sshd/blob/master/sshd-common/src/main/java/org/apache/sshd/common/random/SingletonRandomFactory.java).
   The point of InsecureRandom and InsecureRandomFactory is to make SshServer 
use java.util.Random, an insecure but fast random implementation.
   This was needed because tests magically started to fail on Linux because the 
SSH server took more and more time to start and then refused to start entirely. 
The problem then fixed itself after a few minutes. I realized that the problem 
was that it used /dev/random to seed its internal random engine, which ran out 
of entropy after a while...
   It turns out that this change is not enough, because even though SshServer 
itself will use this random generator, BouncyCastle will still use its secure 
one, that's why the server is started with 
"-Djava.security.egd=file:/dev/./urandom", to make it use /dev/urandom.
   I still kept this because I'm not sure what will happen on Windows, and we 
might need this there.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to