[ 
https://issues.apache.org/jira/browse/SSHD-1149?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17313617#comment-17313617
 ] 

Lyor Goldstein commented on SSHD-1149:
--------------------------------------

{quote}
If the hostkey file contains a valid key, but not the algorithm set for server, 
the file will be overwritten even with setOverwriteAllowed(false).
{quote}
Not a bug - if the loaded file contains the wrong algorithm then it is 
+deleted+ so when the code reaches:
{code:java}
protected void writeKeyPair(KeyPair kp, Path keyPath, OpenOption... options)
            throws IOException, GeneralSecurityException {
        if ((!Files.exists(keyPath)) || isOverwriteAllowed()) {
{code}
The {{Files.exists(keyPath)}} returns _false_ which means that a +new+ file is 
generated.

> Allow every algorithm in PEM hostkey (old behaviour)
> ----------------------------------------------------
>
>                 Key: SSHD-1149
>                 URL: https://issues.apache.org/jira/browse/SSHD-1149
>             Project: MINA SSHD
>          Issue Type: Wish
>    Affects Versions: 2.3.0, 2.5.1
>            Reporter: Stefan Mueller
>            Priority: Major
>
> We upgraded SSHD and replaced PEMGeneratorHostKeyProvider with 
> BouncyCastleGeneratorHostKeyProvider. Now we realized that the behaviour is 
> different if the hostkey file exists. The old class loaded every hostkey, so 
> we could change the algorithm used by replacing the hostkey file. Now the set 
> algorithm will always be used.
> Can you change the behaviour back to where the specified algorithm was only 
> used to create new hostkeys?
> In case you do not change it, I found a bug in current behaviour:
> If the hostkey file contains a valid key, but not the algorithm set for 
> server, the file will be overwritten even with setOverwriteAllowed(false).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org

Reply via email to