blob: d0f1c58416986678e36c9a09d5daf78da705f1e2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
/*
* Copyright (C) 2018, Thomas Wolf <thomas.wolf@paranor.ch> and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0 which is available at
* https://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
package org.eclipse.jgit.transport.sshd;
import java.nio.file.Path;
import java.security.KeyPair;
import java.util.function.Function;
/**
* A cache for {@link KeyPair}s.
*
* @since 5.2
*/
public interface KeyCache {
/**
* Obtains a {@link KeyPair} from the cache. Implementations must be
* thread-safe.
*
* @param path
* of the key
* @param loader
* to load the key if it isn't present in the cache yet
* @return the {@link KeyPair}, or {@code null} if not present and could not
* be loaded
*/
KeyPair get(Path path, Function<? super Path, ? extends KeyPair> loader);
/**
* Removes all {@link KeyPair} from this cache and destroys their private
* keys. This cache instance must not be used anymore thereafter.
*/
void close();
}
|