mirror of
https://codeberg.org/PGPainless/sop-java.git
synced 2024-06-23 03:54:57 +02:00
31 lines
1,007 B
Java
31 lines
1,007 B
Java
|
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
|
||
|
//
|
||
|
// SPDX-License-Identifier: Apache-2.0
|
||
|
|
||
|
package sop.external;
|
||
|
|
||
|
import org.junit.jupiter.api.Test;
|
||
|
import org.junit.jupiter.api.condition.EnabledIf;
|
||
|
|
||
|
import java.io.IOException;
|
||
|
|
||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||
|
|
||
|
@EnabledIf("sop.external.AbstractExternalSOPTest#isExternalSopInstalled")
|
||
|
public class ExternalGenerateKeyTest extends AbstractExternalSOPTest {
|
||
|
|
||
|
@Test
|
||
|
public void generateKeyTest() throws IOException {
|
||
|
String key = new String(getSop().generateKey().userId("Alice").generate().getBytes());
|
||
|
assertTrue(key.startsWith("-----BEGIN PGP PRIVATE KEY BLOCK-----\n"));
|
||
|
}
|
||
|
|
||
|
@Test
|
||
|
public void generateKeyWithPasswordTest() throws IOException {
|
||
|
String key = new String(getSop().generateKey().userId("Alice").withKeyPassword("swßrdf1sh").generate().getBytes());
|
||
|
assertEquals("asd", key);
|
||
|
}
|
||
|
|
||
|
}
|