LS2: Select first supported encryption key from leaseset

OCMOSJ: Fail if unsupported crypto or bad ls type
This commit is contained in:
zzz
2019-01-27 15:59:34 +00:00
parent 0889a751db
commit 3cd12ecefc
2 changed files with 35 additions and 3 deletions

View File

@ -66,6 +66,24 @@ public class LeaseSet2 extends LeaseSet {
return _options.getProperty(opt);
}
/**
* If more than one key, return the first supported one.
* If none supported, return the first one.
*
* @since 0.9.39 overridden
*/
@Override
public PublicKey getEncryptionKey() {
if (_encryptionKeys != null) {
for (PublicKey pk : _encryptionKeys) {
EncType type = pk.getType();
if (type != null && type.isAvailable())
return pk;
}
}
return _encryptionKey;
}
/**
* Add an encryption key.
*/