• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In
Recached

pgpainless / sop-java / #17

15 Nov 2023 01:23PM UTC coverage: 65.932% (-3.9%) from 69.789%
#17

push

other

vanitasvitae
Fix gradle version

1167 of 1770 relevant lines covered (65.93%)

0.66 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

71.43
/external-sop/src/main/java/sop/external/operation/RevokeKeyExternal.java
1
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
2
//
3
// SPDX-License-Identifier: Apache-2.0
4

5
package sop.external.operation;
6

7
import sop.Ready;
8
import sop.exception.SOPGPException;
9
import sop.external.ExternalSOP;
10
import sop.operation.RevokeKey;
11

12
import javax.annotation.Nonnull;
13
import java.io.InputStream;
14
import java.util.ArrayList;
15
import java.util.List;
16
import java.util.Properties;
17

18
public class RevokeKeyExternal implements RevokeKey {
19

20
    private final List<String> commandList = new ArrayList<>();
1✔
21
    private final List<String> envList;
22

23
    private int withKeyPasswordCounter = 0;
1✔
24

25
    public RevokeKeyExternal(String binary, Properties environment) {
1✔
26
        this.commandList.add(binary);
1✔
27
        this.commandList.add("revoke-key");
1✔
28
        this.envList = ExternalSOP.propertiesToEnv(environment);
1✔
29
    }
1✔
30

31
    @Override
32
    @Nonnull
33
    public RevokeKey noArmor() {
34
        this.commandList.add("--no-armor");
1✔
35
        return this;
1✔
36
    }
37

38
    @Override
39
    @Nonnull
40
    public RevokeKey withKeyPassword(@Nonnull byte[] password) throws SOPGPException.UnsupportedOption, SOPGPException.PasswordNotHumanReadable {
41
        String envVar = "KEY_PASSWORD_" + withKeyPasswordCounter++;
×
42
        commandList.add("--with-key-password=@ENV:" + envVar);
×
43
        envList.add(envVar + "=" + new String(password));
×
44
        return this;
×
45
    }
46

47
    @Override
48
    @Nonnull
49
    public Ready keys(@Nonnull InputStream keys) {
50
        return ExternalSOP.executeTransformingOperation(Runtime.getRuntime(), commandList, envList, keys);
1✔
51
    }
52
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc