[
https://issues.apache.org/jira/browse/SSHD-1054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17177953#comment-17177953
]
Lyor Goldstein commented on SSHD-1054:
--------------------------------------
{quote}
Then used "setCipherFactories()" method to set the all the ciphers which are
supported.
{quote}
Didn't you mean {{getCipherFactories}} ?
Anyway - you are calling both {{setCipherFactoriesNames}} and
{{setCipherFactories}} - which means you are actually manipulating the +same
list+ - whichever you call last "wins" (in this case {{setCipherFactories}} was
last called so it is the one that was in effect).
{{setCipherFactoriesNames}} is a +convenience method+ that does some parsing
and then invokes {{setCipherFactories}} as can be clearly seen in the source
code:
{code:java}
default void setCipherFactoriesNameList(String names) {
setCipherFactoriesNames(GenericUtils.split(names, ','));
}
default void setCipherFactoriesNames(String... names) {
setCipherFactoriesNames(GenericUtils.isEmpty((Object[]) names) ?
Collections.emptyList() : Arrays.asList(names));
}
default void setCipherFactoriesNames(Collection<String> names) {
BuiltinCiphers.ParseResult result =
BuiltinCiphers.parseCiphersList(names);
@SuppressWarnings({ "rawtypes", "unchecked" })
List<NamedFactory<Cipher>> factories = (List)
ValidateUtils.checkNotNullAndNotEmpty(result.getParsedFactories(),
"No supported cipher factories: %s", names);
Collection<String> unsupported = result.getUnsupportedFactories();
ValidateUtils.checkTrue(GenericUtils.isEmpty(unsupported), "Unsupported
cipher factories found: %s", unsupported);
setCipherFactories(factories); // <<<<==============
}
{code}
> Not able to get the correct cipher/mac/key values in negotiation options of
> SSHD
> --------------------------------------------------------------------------------
>
> Key: SSHD-1054
> URL: https://issues.apache.org/jira/browse/SSHD-1054
> Project: MINA SSHD
> Issue Type: New Feature
> Reporter: Rohini Jori
> Priority: Major
> Attachments: Negotiated_option.png, addclientcipher_code.png,
> logs_cipher.png
>
>
> We are setting the cipher , mac and key-exchange algorithm through which the
> client & server communication should happens.
> So I used the "setCipherFactoriesNames()" method to set the cipher which
> actually going to use in communication. Then used "setCipherFactories()"
> method to set the all the ciphers which are supported.
> But when I print the
> "sftpClient.getSession().getNegotiatedKexParameter(KexProposalOption.C2SENC);"
>
> it returns the random cipher instead of actual being used.
> So this getNegotiatedKexParameter returning the wrong value even when we set
> the correct cipher.
>
> So how can we get the value set by "setCipherFactoriesNames()" method when
> printing the session information about the used ciphers/mac/keys?
> Please refer the attached code snapshot and logs.
>
>
>
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]