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 42 43 44 45 46 47 48 49 50
|
Description: PEM classes are currently not packaged in Debian
Author: Pierre Gruet <pgt@debian.org>
Forwarded: not-needed
Last-Update: 2024-04-29
--- a/sshd-common/src/test/java/org/apache/sshd/common/config/keys/loader/pem/PKCS8PEMResourceKeyPairParserTest.java
+++ b/sshd-common/src/test/java/org/apache/sshd/common/config/keys/loader/pem/PKCS8PEMResourceKeyPairParserTest.java
@@ -31,8 +31,6 @@
import java.util.Collection;
import java.util.List;
-import org.apache.commons.ssl.PEMItem;
-import org.apache.commons.ssl.PEMUtil;
import org.apache.sshd.common.NamedResource;
import org.apache.sshd.common.cipher.ECCurves;
import org.apache.sshd.common.config.keys.KeyUtils;
@@ -94,33 +92,6 @@
return params;
}
- @Test // see SSHD-760
- public void testLocallyGeneratedPkcs8() throws IOException, GeneralSecurityException {
- KeyPairGenerator generator = SecurityUtils.getKeyPairGenerator(algorithm);
- if (keySize > 0) {
- generator.initialize(keySize);
- }
-
- KeyPair kp = generator.generateKeyPair();
- try (ByteArrayOutputStream os = new ByteArrayOutputStream()) {
- Collection<Object> items = new ArrayList<>();
- PrivateKey prv1 = kp.getPrivate();
- items.add(new PEMItem(prv1.getEncoded(), "PRIVATE KEY"));
- byte[] bytes = PEMUtil.encode(items);
- os.write(bytes);
- os.close();
-
- try (ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
- Iterable<KeyPair> ids = SecurityUtils.loadKeyPairIdentities(
- null, NamedResource.ofName(getCurrentTestName()), bais, null);
- KeyPair kp2 = GenericUtils.head(ids);
- assertNotNull("No identity loaded", kp2);
- assertKeyEquals("Mismatched public key", kp.getPublic(), kp2.getPublic());
- assertKeyEquals("Mismatched private key", prv1, kp2.getPrivate());
- }
- }
- }
-
/*
* See https://gist.github.com/briansmith/2ee42439923d8e65a266994d0f70180b
*
|