mirror of
https://github.com/pgpainless/pgpainless.git
synced 2025-09-14 12:49:39 +02:00
Compare commits
24 commits
Author | SHA1 | Date | |
---|---|---|---|
d698cde7d5 | |||
294efbca25 | |||
0ad5df76f8 | |||
a0a3d59cec | |||
48a323441a | |||
b942cb8747 | |||
a056dc9881 | |||
9a4c24d822 | |||
9022c27438 | |||
b8c10d4c53 | |||
cdc3bdd9ef | |||
ebd6a7d2ae | |||
b54ebb22c4 | |||
b6724d485c | |||
19e484b552 | |||
8e768636c8 | |||
05ae631a12 | |||
43a29729ad | |||
93208ee7bb | |||
65a8946923 | |||
5b6158d64b | |||
58c3afae3e | |||
9a52f0e0aa | |||
fad5603c69 |
16 changed files with 390 additions and 59 deletions
18
CHANGELOG.md
18
CHANGELOG.md
|
@ -5,6 +5,24 @@ SPDX-License-Identifier: CC0-1.0
|
||||||
|
|
||||||
# PGPainless Changelog
|
# PGPainless Changelog
|
||||||
|
|
||||||
|
## 1.3.17
|
||||||
|
- Bugfix: Direct-Key signatures are calculated over the signee key only, not the signer key + signee key
|
||||||
|
- Security: Fix faulty bit-strength policy check for signing subkeys
|
||||||
|
|
||||||
|
## 1.3.16
|
||||||
|
- Bump `sop-java` to `4.1.0`
|
||||||
|
- Bump `gradlew` to `7.5`
|
||||||
|
|
||||||
|
## 1.3.15
|
||||||
|
- Fix crash in `sop generate-key --with-key-password` when more than one user-id is given
|
||||||
|
- `sop generate-key`: Allow key generation without user-ids
|
||||||
|
- `sop inline-sign --as=clearsigned`: Make signatures of type 'text' instead of 'binary'
|
||||||
|
|
||||||
|
## 1.3.14
|
||||||
|
- Bump `bcpg` to `1.72.3`
|
||||||
|
- Fix DSA key parameter check
|
||||||
|
- Use proper method to unlock private signing keys when creating detached signatures
|
||||||
|
|
||||||
## 1.3.13
|
## 1.3.13
|
||||||
- Bump `sop-java` to `4.0.7`
|
- Bump `sop-java` to `4.0.7`
|
||||||
|
|
||||||
|
|
|
@ -191,7 +191,7 @@ repositories {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'org.pgpainless:pgpainless-core:1.3.13'
|
implementation 'org.pgpainless:pgpainless-core:1.3.17'
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,5 +1,5 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-rc-1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
|
@ -287,6 +287,7 @@ public class ConsumerOptions {
|
||||||
* @return options
|
* @return options
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
// Is used to be compatible with legacy systems
|
||||||
public ConsumerOptions setIgnoreMDCErrors(boolean ignoreMDCErrors) {
|
public ConsumerOptions setIgnoreMDCErrors(boolean ignoreMDCErrors) {
|
||||||
this.ignoreMDCErrors = ignoreMDCErrors;
|
this.ignoreMDCErrors = ignoreMDCErrors;
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -245,6 +245,7 @@ public final class ProducerOptions {
|
||||||
* @deprecated options other than the default value of {@link StreamEncoding#BINARY} are discouraged.
|
* @deprecated options other than the default value of {@link StreamEncoding#BINARY} are discouraged.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
// is used to be compatible with legacy systems
|
||||||
public ProducerOptions setEncoding(@Nonnull StreamEncoding encoding) {
|
public ProducerOptions setEncoding(@Nonnull StreamEncoding encoding) {
|
||||||
this.encodingField = encoding;
|
this.encodingField = encoding;
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -359,8 +359,7 @@ public final class SigningOptions {
|
||||||
if (signingSecKey == null) {
|
if (signingSecKey == null) {
|
||||||
throw new KeyException.MissingSecretKeyException(OpenPgpFingerprint.of(secretKey), signingPubKey.getKeyID());
|
throw new KeyException.MissingSecretKeyException(OpenPgpFingerprint.of(secretKey), signingPubKey.getKeyID());
|
||||||
}
|
}
|
||||||
PGPPrivateKey signingSubkey = signingSecKey.extractPrivateKey(
|
PGPPrivateKey signingSubkey = UnlockSecretKey.unlockSecretKey(signingSecKey, secretKeyDecryptor);
|
||||||
secretKeyDecryptor.getDecryptor(signingPubKey.getKeyID()));
|
|
||||||
Set<HashAlgorithm> hashAlgorithms = userId != null ? keyRingInfo.getPreferredHashAlgorithms(userId)
|
Set<HashAlgorithm> hashAlgorithms = userId != null ? keyRingInfo.getPreferredHashAlgorithms(userId)
|
||||||
: keyRingInfo.getPreferredHashAlgorithms(signingPubKey.getKeyID());
|
: keyRingInfo.getPreferredHashAlgorithms(signingPubKey.getKeyID());
|
||||||
HashAlgorithm hashAlgorithm = negotiateHashAlgorithm(hashAlgorithms, PGPainless.getPolicy());
|
HashAlgorithm hashAlgorithm = negotiateHashAlgorithm(hashAlgorithms, PGPainless.getPolicy());
|
||||||
|
@ -380,7 +379,7 @@ public final class SigningOptions {
|
||||||
SubkeyIdentifier signingKeyIdentifier = new SubkeyIdentifier(secretKey, signingSubkey.getKeyID());
|
SubkeyIdentifier signingKeyIdentifier = new SubkeyIdentifier(secretKey, signingSubkey.getKeyID());
|
||||||
PGPSecretKey signingSecretKey = secretKey.getSecretKey(signingSubkey.getKeyID());
|
PGPSecretKey signingSecretKey = secretKey.getSecretKey(signingSubkey.getKeyID());
|
||||||
PublicKeyAlgorithm publicKeyAlgorithm = PublicKeyAlgorithm.requireFromId(signingSecretKey.getPublicKey().getAlgorithm());
|
PublicKeyAlgorithm publicKeyAlgorithm = PublicKeyAlgorithm.requireFromId(signingSecretKey.getPublicKey().getAlgorithm());
|
||||||
int bitStrength = secretKey.getPublicKey().getBitStrength();
|
int bitStrength = signingSecretKey.getPublicKey().getBitStrength();
|
||||||
if (!PGPainless.getPolicy().getPublicKeyAlgorithmPolicy().isAcceptable(publicKeyAlgorithm, bitStrength)) {
|
if (!PGPainless.getPolicy().getPublicKeyAlgorithmPolicy().isAcceptable(publicKeyAlgorithm, bitStrength)) {
|
||||||
throw new KeyException.UnacceptableSigningKeyException(
|
throw new KeyException.UnacceptableSigningKeyException(
|
||||||
new KeyException.PublicKeyAlgorithmPolicyException(
|
new KeyException.PublicKeyAlgorithmPolicyException(
|
||||||
|
|
|
@ -7,6 +7,7 @@ package org.pgpainless.key.generation;
|
||||||
import java.security.InvalidAlgorithmParameterException;
|
import java.security.InvalidAlgorithmParameterException;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import org.bouncycastle.openpgp.PGPException;
|
import org.bouncycastle.openpgp.PGPException;
|
||||||
import org.bouncycastle.openpgp.PGPSecretKeyRing;
|
import org.bouncycastle.openpgp.PGPSecretKeyRing;
|
||||||
|
@ -38,9 +39,9 @@ public final class KeyRingTemplates {
|
||||||
* @throws NoSuchAlgorithmException in case of missing algorithm implementation in the crypto provider
|
* @throws NoSuchAlgorithmException in case of missing algorithm implementation in the crypto provider
|
||||||
* @throws PGPException in case of an OpenPGP related error
|
* @throws PGPException in case of an OpenPGP related error
|
||||||
*/
|
*/
|
||||||
public PGPSecretKeyRing simpleRsaKeyRing(@Nonnull UserId userId, @Nonnull RsaLength length)
|
public PGPSecretKeyRing simpleRsaKeyRing(@Nullable UserId userId, @Nonnull RsaLength length)
|
||||||
throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, PGPException {
|
throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, PGPException {
|
||||||
return simpleRsaKeyRing(userId.toString(), length);
|
return simpleRsaKeyRing(userId == null ? null : userId.toString(), length);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -56,7 +57,7 @@ public final class KeyRingTemplates {
|
||||||
* @throws NoSuchAlgorithmException in case of missing algorithm implementation in the crypto provider
|
* @throws NoSuchAlgorithmException in case of missing algorithm implementation in the crypto provider
|
||||||
* @throws PGPException in case of an OpenPGP related error
|
* @throws PGPException in case of an OpenPGP related error
|
||||||
*/
|
*/
|
||||||
public PGPSecretKeyRing simpleRsaKeyRing(@Nonnull String userId, @Nonnull RsaLength length)
|
public PGPSecretKeyRing simpleRsaKeyRing(@Nullable String userId, @Nonnull RsaLength length)
|
||||||
throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, PGPException {
|
throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, PGPException {
|
||||||
return simpleRsaKeyRing(userId, length, Passphrase.emptyPassphrase());
|
return simpleRsaKeyRing(userId, length, Passphrase.emptyPassphrase());
|
||||||
}
|
}
|
||||||
|
@ -75,9 +76,9 @@ public final class KeyRingTemplates {
|
||||||
* @throws NoSuchAlgorithmException in case of missing algorithm implementation in the crypto provider
|
* @throws NoSuchAlgorithmException in case of missing algorithm implementation in the crypto provider
|
||||||
* @throws PGPException in case of an OpenPGP related error
|
* @throws PGPException in case of an OpenPGP related error
|
||||||
*/
|
*/
|
||||||
public PGPSecretKeyRing simpleRsaKeyRing(@Nonnull UserId userId, @Nonnull RsaLength length, String password)
|
public PGPSecretKeyRing simpleRsaKeyRing(@Nullable UserId userId, @Nonnull RsaLength length, @Nullable String password)
|
||||||
throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, PGPException {
|
throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, PGPException {
|
||||||
return simpleRsaKeyRing(userId.toString(), length, password);
|
return simpleRsaKeyRing(userId == null ? null : userId.toString(), length, password);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -94,7 +95,7 @@ public final class KeyRingTemplates {
|
||||||
* @throws NoSuchAlgorithmException in case of missing algorithm implementation in the crypto provider
|
* @throws NoSuchAlgorithmException in case of missing algorithm implementation in the crypto provider
|
||||||
* @throws PGPException in case of an OpenPGP related error
|
* @throws PGPException in case of an OpenPGP related error
|
||||||
*/
|
*/
|
||||||
public PGPSecretKeyRing simpleRsaKeyRing(@Nonnull String userId, @Nonnull RsaLength length, String password)
|
public PGPSecretKeyRing simpleRsaKeyRing(@Nullable String userId, @Nonnull RsaLength length, @Nullable String password)
|
||||||
throws PGPException, NoSuchAlgorithmException, InvalidAlgorithmParameterException {
|
throws PGPException, NoSuchAlgorithmException, InvalidAlgorithmParameterException {
|
||||||
Passphrase passphrase = Passphrase.emptyPassphrase();
|
Passphrase passphrase = Passphrase.emptyPassphrase();
|
||||||
if (!isNullOrEmpty(password)) {
|
if (!isNullOrEmpty(password)) {
|
||||||
|
@ -103,12 +104,14 @@ public final class KeyRingTemplates {
|
||||||
return simpleRsaKeyRing(userId, length, passphrase);
|
return simpleRsaKeyRing(userId, length, passphrase);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PGPSecretKeyRing simpleRsaKeyRing(@Nonnull String userId, @Nonnull RsaLength length, @Nonnull Passphrase passphrase)
|
public PGPSecretKeyRing simpleRsaKeyRing(@Nullable String userId, @Nonnull RsaLength length, @Nonnull Passphrase passphrase)
|
||||||
throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException {
|
throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException {
|
||||||
KeyRingBuilder builder = PGPainless.buildKeyRing()
|
KeyRingBuilder builder = PGPainless.buildKeyRing()
|
||||||
.setPrimaryKey(KeySpec.getBuilder(KeyType.RSA(length), KeyFlag.CERTIFY_OTHER, KeyFlag.SIGN_DATA, KeyFlag.ENCRYPT_COMMS))
|
.setPrimaryKey(KeySpec.getBuilder(KeyType.RSA(length), KeyFlag.CERTIFY_OTHER, KeyFlag.SIGN_DATA, KeyFlag.ENCRYPT_COMMS))
|
||||||
.addUserId(userId)
|
|
||||||
.setPassphrase(passphrase);
|
.setPassphrase(passphrase);
|
||||||
|
if (userId != null) {
|
||||||
|
builder.addUserId(userId);
|
||||||
|
}
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,9 +128,9 @@ public final class KeyRingTemplates {
|
||||||
* @throws NoSuchAlgorithmException in case of missing algorithm implementation in the crypto provider
|
* @throws NoSuchAlgorithmException in case of missing algorithm implementation in the crypto provider
|
||||||
* @throws PGPException in case of an OpenPGP related error
|
* @throws PGPException in case of an OpenPGP related error
|
||||||
*/
|
*/
|
||||||
public PGPSecretKeyRing simpleEcKeyRing(@Nonnull UserId userId)
|
public PGPSecretKeyRing simpleEcKeyRing(@Nullable UserId userId)
|
||||||
throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, PGPException {
|
throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, PGPException {
|
||||||
return simpleEcKeyRing(userId.toString());
|
return simpleEcKeyRing(userId == null ? null : userId.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -143,7 +146,7 @@ public final class KeyRingTemplates {
|
||||||
* @throws NoSuchAlgorithmException in case of missing algorithm implementation in the crypto provider
|
* @throws NoSuchAlgorithmException in case of missing algorithm implementation in the crypto provider
|
||||||
* @throws PGPException in case of an OpenPGP related error
|
* @throws PGPException in case of an OpenPGP related error
|
||||||
*/
|
*/
|
||||||
public PGPSecretKeyRing simpleEcKeyRing(@Nonnull String userId)
|
public PGPSecretKeyRing simpleEcKeyRing(@Nullable String userId)
|
||||||
throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, PGPException {
|
throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, PGPException {
|
||||||
return simpleEcKeyRing(userId, Passphrase.emptyPassphrase());
|
return simpleEcKeyRing(userId, Passphrase.emptyPassphrase());
|
||||||
}
|
}
|
||||||
|
@ -162,9 +165,9 @@ public final class KeyRingTemplates {
|
||||||
* @throws NoSuchAlgorithmException in case of missing algorithm implementation in the crypto provider
|
* @throws NoSuchAlgorithmException in case of missing algorithm implementation in the crypto provider
|
||||||
* @throws PGPException in case of an OpenPGP related error
|
* @throws PGPException in case of an OpenPGP related error
|
||||||
*/
|
*/
|
||||||
public PGPSecretKeyRing simpleEcKeyRing(@Nonnull UserId userId, String password)
|
public PGPSecretKeyRing simpleEcKeyRing(@Nullable UserId userId, String password)
|
||||||
throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, PGPException {
|
throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, PGPException {
|
||||||
return simpleEcKeyRing(userId.toString(), password);
|
return simpleEcKeyRing(userId == null ? null : userId.toString(), password);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -181,7 +184,7 @@ public final class KeyRingTemplates {
|
||||||
* @throws NoSuchAlgorithmException in case of missing algorithm implementation in the crypto provider
|
* @throws NoSuchAlgorithmException in case of missing algorithm implementation in the crypto provider
|
||||||
* @throws PGPException in case of an OpenPGP related error
|
* @throws PGPException in case of an OpenPGP related error
|
||||||
*/
|
*/
|
||||||
public PGPSecretKeyRing simpleEcKeyRing(@Nonnull String userId, String password)
|
public PGPSecretKeyRing simpleEcKeyRing(@Nullable String userId, String password)
|
||||||
throws PGPException, NoSuchAlgorithmException, InvalidAlgorithmParameterException {
|
throws PGPException, NoSuchAlgorithmException, InvalidAlgorithmParameterException {
|
||||||
Passphrase passphrase = Passphrase.emptyPassphrase();
|
Passphrase passphrase = Passphrase.emptyPassphrase();
|
||||||
if (!isNullOrEmpty(password)) {
|
if (!isNullOrEmpty(password)) {
|
||||||
|
@ -190,13 +193,15 @@ public final class KeyRingTemplates {
|
||||||
return simpleEcKeyRing(userId, passphrase);
|
return simpleEcKeyRing(userId, passphrase);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PGPSecretKeyRing simpleEcKeyRing(@Nonnull String userId, @Nonnull Passphrase passphrase)
|
public PGPSecretKeyRing simpleEcKeyRing(@Nullable String userId, @Nonnull Passphrase passphrase)
|
||||||
throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException {
|
throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException {
|
||||||
KeyRingBuilder builder = PGPainless.buildKeyRing()
|
KeyRingBuilder builder = PGPainless.buildKeyRing()
|
||||||
.setPrimaryKey(KeySpec.getBuilder(KeyType.EDDSA(EdDSACurve._Ed25519), KeyFlag.CERTIFY_OTHER, KeyFlag.SIGN_DATA))
|
.setPrimaryKey(KeySpec.getBuilder(KeyType.EDDSA(EdDSACurve._Ed25519), KeyFlag.CERTIFY_OTHER, KeyFlag.SIGN_DATA))
|
||||||
.addSubkey(KeySpec.getBuilder(KeyType.XDH(XDHSpec._X25519), KeyFlag.ENCRYPT_STORAGE, KeyFlag.ENCRYPT_COMMS))
|
.addSubkey(KeySpec.getBuilder(KeyType.XDH(XDHSpec._X25519), KeyFlag.ENCRYPT_STORAGE, KeyFlag.ENCRYPT_COMMS))
|
||||||
.addUserId(userId)
|
|
||||||
.setPassphrase(passphrase);
|
.setPassphrase(passphrase);
|
||||||
|
if (userId != null) {
|
||||||
|
builder.addUserId(userId);
|
||||||
|
}
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,8 +216,8 @@ public final class KeyRingTemplates {
|
||||||
* @throws NoSuchAlgorithmException in case of missing algorithm implementation in the crypto provider
|
* @throws NoSuchAlgorithmException in case of missing algorithm implementation in the crypto provider
|
||||||
* @throws PGPException in case of an OpenPGP related error
|
* @throws PGPException in case of an OpenPGP related error
|
||||||
*/
|
*/
|
||||||
public PGPSecretKeyRing modernKeyRing(String userId) throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException {
|
public PGPSecretKeyRing modernKeyRing(@Nullable String userId) throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException {
|
||||||
return modernKeyRing(userId, (Passphrase) null);
|
return modernKeyRing(userId, Passphrase.emptyPassphrase());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -227,21 +232,21 @@ public final class KeyRingTemplates {
|
||||||
* @throws NoSuchAlgorithmException in case of missing algorithm implementation in the crypto provider
|
* @throws NoSuchAlgorithmException in case of missing algorithm implementation in the crypto provider
|
||||||
* @throws PGPException in case of an OpenPGP related error
|
* @throws PGPException in case of an OpenPGP related error
|
||||||
*/
|
*/
|
||||||
public PGPSecretKeyRing modernKeyRing(String userId, String password)
|
public PGPSecretKeyRing modernKeyRing(@Nullable String userId, @Nullable String password)
|
||||||
throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, PGPException {
|
throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, PGPException {
|
||||||
Passphrase passphrase = (password != null ? Passphrase.fromPassword(password) : null);
|
Passphrase passphrase = (password != null ? Passphrase.fromPassword(password) : Passphrase.emptyPassphrase());
|
||||||
return modernKeyRing(userId, passphrase);
|
return modernKeyRing(userId, passphrase);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PGPSecretKeyRing modernKeyRing(String userId, Passphrase passphrase)
|
public PGPSecretKeyRing modernKeyRing(@Nullable String userId, @Nonnull Passphrase passphrase)
|
||||||
throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException {
|
throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException {
|
||||||
KeyRingBuilder builder = PGPainless.buildKeyRing()
|
KeyRingBuilder builder = PGPainless.buildKeyRing()
|
||||||
.setPrimaryKey(KeySpec.getBuilder(KeyType.EDDSA(EdDSACurve._Ed25519), KeyFlag.CERTIFY_OTHER))
|
.setPrimaryKey(KeySpec.getBuilder(KeyType.EDDSA(EdDSACurve._Ed25519), KeyFlag.CERTIFY_OTHER))
|
||||||
.addSubkey(KeySpec.getBuilder(KeyType.XDH(XDHSpec._X25519), KeyFlag.ENCRYPT_STORAGE, KeyFlag.ENCRYPT_COMMS))
|
.addSubkey(KeySpec.getBuilder(KeyType.XDH(XDHSpec._X25519), KeyFlag.ENCRYPT_STORAGE, KeyFlag.ENCRYPT_COMMS))
|
||||||
.addSubkey(KeySpec.getBuilder(KeyType.EDDSA(EdDSACurve._Ed25519), KeyFlag.SIGN_DATA))
|
.addSubkey(KeySpec.getBuilder(KeyType.EDDSA(EdDSACurve._Ed25519), KeyFlag.SIGN_DATA))
|
||||||
.addUserId(userId);
|
.setPassphrase(passphrase);
|
||||||
if (passphrase != null && !passphrase.isEmpty()) {
|
if (userId != null) {
|
||||||
builder.setPassphrase(passphrase);
|
builder.addUserId(userId);
|
||||||
}
|
}
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
|
@ -195,7 +195,7 @@ public class PublicKeyParameterValidationUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
// q > 160 bits
|
// q > 160 bits
|
||||||
boolean qLarge = pQ.getLowestSetBit() > 160;
|
boolean qLarge = pQ.bitLength() > 160;
|
||||||
if (!qLarge) {
|
if (!qLarge) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,12 +43,8 @@ public class ThirdPartyDirectKeySignatureBuilder extends AbstractSignatureBuilde
|
||||||
|
|
||||||
public PGPSignature build(PGPPublicKey key) throws PGPException {
|
public PGPSignature build(PGPPublicKey key) throws PGPException {
|
||||||
PGPSignatureGenerator signatureGenerator = buildAndInitSignatureGenerator();
|
PGPSignatureGenerator signatureGenerator = buildAndInitSignatureGenerator();
|
||||||
if (key.getKeyID() != publicSigningKey.getKeyID()) {
|
|
||||||
return signatureGenerator.generateCertification(publicSigningKey, key);
|
|
||||||
} else {
|
|
||||||
return signatureGenerator.generateCertification(key);
|
return signatureGenerator.generateCertification(key);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isValidSignatureType(SignatureType type) {
|
protected boolean isValidSignatureType(SignatureType type) {
|
||||||
|
|
|
@ -535,10 +535,10 @@ public abstract class SignatureValidator {
|
||||||
try {
|
try {
|
||||||
signature.init(ImplementationFactory.getInstance().getPGPContentVerifierBuilderProvider(), signer);
|
signature.init(ImplementationFactory.getInstance().getPGPContentVerifierBuilderProvider(), signer);
|
||||||
boolean valid;
|
boolean valid;
|
||||||
if (signer.getKeyID() != signee.getKeyID()) {
|
if (signer.getKeyID() == signee.getKeyID() || signature.getSignatureType() == PGPSignature.DIRECT_KEY) {
|
||||||
valid = signature.verifyCertification(signer, signee);
|
|
||||||
} else {
|
|
||||||
valid = signature.verifyCertification(signee);
|
valid = signature.verifyCertification(signee);
|
||||||
|
} else {
|
||||||
|
valid = signature.verifyCertification(signer, signee);
|
||||||
}
|
}
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
throw new SignatureValidationException("Signature is not correct.");
|
throw new SignatureValidationException("Signature is not correct.");
|
||||||
|
|
|
@ -23,7 +23,7 @@ To start using pgpainless-sop in your code, include the following lines in your
|
||||||
...
|
...
|
||||||
dependencies {
|
dependencies {
|
||||||
...
|
...
|
||||||
implementation "org.pgpainless:pgpainless-sop:1.3.13"
|
implementation "org.pgpainless:pgpainless-sop:1.3.17"
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ dependencies {
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.pgpainless</groupId>
|
<groupId>org.pgpainless</groupId>
|
||||||
<artifactId>pgpainless-sop</artifactId>
|
<artifactId>pgpainless-sop</artifactId>
|
||||||
<version>1.3.13</version>
|
<version>1.3.17</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
...
|
...
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class GenerateKeyImpl implements GenerateKey {
|
||||||
|
|
||||||
private boolean armor = true;
|
private boolean armor = true;
|
||||||
private final Set<String> userIds = new LinkedHashSet<>();
|
private final Set<String> userIds = new LinkedHashSet<>();
|
||||||
private Passphrase passphrase;
|
private Passphrase passphrase = Passphrase.emptyPassphrase();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GenerateKey noArmor() {
|
public GenerateKey noArmor() {
|
||||||
|
@ -51,20 +51,18 @@ public class GenerateKeyImpl implements GenerateKey {
|
||||||
@Override
|
@Override
|
||||||
public Ready generate() throws SOPGPException.MissingArg, SOPGPException.UnsupportedAsymmetricAlgo {
|
public Ready generate() throws SOPGPException.MissingArg, SOPGPException.UnsupportedAsymmetricAlgo {
|
||||||
Iterator<String> userIdIterator = userIds.iterator();
|
Iterator<String> userIdIterator = userIds.iterator();
|
||||||
if (!userIdIterator.hasNext()) {
|
Passphrase passphraseCopy = new Passphrase(passphrase.getChars()); // generateKeyRing clears the original passphrase
|
||||||
throw new SOPGPException.MissingArg("Missing user-id.");
|
|
||||||
}
|
|
||||||
|
|
||||||
PGPSecretKeyRing key;
|
PGPSecretKeyRing key;
|
||||||
try {
|
try {
|
||||||
|
String primaryUserId = userIdIterator.hasNext() ? userIdIterator.next() : null;
|
||||||
key = PGPainless.generateKeyRing()
|
key = PGPainless.generateKeyRing()
|
||||||
.modernKeyRing(userIdIterator.next(), passphrase);
|
.modernKeyRing(primaryUserId, passphrase);
|
||||||
|
|
||||||
if (userIdIterator.hasNext()) {
|
if (userIdIterator.hasNext()) {
|
||||||
SecretKeyRingEditorInterface editor = PGPainless.modifyKeyRing(key);
|
SecretKeyRingEditorInterface editor = PGPainless.modifyKeyRing(key);
|
||||||
|
|
||||||
while (userIdIterator.hasNext()) {
|
while (userIdIterator.hasNext()) {
|
||||||
editor.addUserId(userIdIterator.next(), SecretKeyRingProtector.unprotectedKeys());
|
editor.addUserId(userIdIterator.next(), SecretKeyRingProtector.unlockAnyKeyWith(passphraseCopy));
|
||||||
}
|
}
|
||||||
|
|
||||||
key = editor.done();
|
key = editor.done();
|
||||||
|
|
|
@ -75,7 +75,7 @@ public class InlineSignImpl implements InlineSign {
|
||||||
for (PGPSecretKeyRing key : signingKeys) {
|
for (PGPSecretKeyRing key : signingKeys) {
|
||||||
try {
|
try {
|
||||||
if (mode == InlineSignAs.clearsigned) {
|
if (mode == InlineSignAs.clearsigned) {
|
||||||
signingOptions.addDetachedSignature(protector, key);
|
signingOptions.addDetachedSignature(protector, key, DocumentSignatureType.CANONICAL_TEXT_DOCUMENT);
|
||||||
} else {
|
} else {
|
||||||
signingOptions.addInlineSignature(protector, key, modeToSigType(mode));
|
signingOptions.addInlineSignature(protector, key, modeToSigType(mode));
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,295 @@
|
||||||
|
// SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
package org.pgpainless.sop;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import sop.ByteArrayAndResult;
|
||||||
|
import sop.DecryptionResult;
|
||||||
|
import sop.Ready;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
public class CarolKeySignEncryptRoundtripTest {
|
||||||
|
|
||||||
|
private static final String CAROL_KEY = "-----BEGIN PGP PRIVATE KEY BLOCK-----\n" +
|
||||||
|
"\n" +
|
||||||
|
"xcQTBF3+CmgRDADZhdKTM3ms3XpXnQke83FgaIBtP1g1qhqpCfg50WiPS0kjiMC0\n" +
|
||||||
|
"OJz2vh59nusbBLzgI//Y1VMhKfIWYbqMcIY+lWbseHjl52rqW6AaJ0TH4NgVt7vh\n" +
|
||||||
|
"yVeJt0k/NnxvNhMd0587KXmfpDxrwBqc/l5cVB+p0rL8vs8kxojHXAi5V3koM0Uj\n" +
|
||||||
|
"REWs5Jpj/XU9LhEoyXZkeJC/pes1u6UKoFYn7dFIP49Kkd1kb+1bNfdPYtA0JpcG\n" +
|
||||||
|
"zYgeMNOvd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Bl\n" +
|
||||||
|
"5nEsQ4HLv8OQ3EgJ5T9gldLFpHNczLxBQnnNwfPoD2e0kC/iy0rfiNX8HWpTgQpb\n" +
|
||||||
|
"zAosLj5/E0iNlildynIhuqBosyRWFqGva0O6qioL90srlzlfKCloe9R9w3HizjCb\n" +
|
||||||
|
"f59yEspuJt9iHVNOPOW2Wj5ub0KTiJPp9vBmrFaB79/IlgojpQoYvQ77Hx5A9CJq\n" +
|
||||||
|
"paMCHGOW6Uz9euN1ozzETEkIPtL8XAxcogfpe2JKE1uS7ugxsKEGEDfxOQFKAGV0\n" +
|
||||||
|
"XFtIx50vFCr2vQro0WB858CGN47dCxChhNUxNtGc11JNEkNv/X7hKtRf/5VCmnaz\n" +
|
||||||
|
"GWwNK47cqZ7GJfEBnElD7s/tQvTC5Qp7lg9gEt47TUX0bjzUTCxNvLosuKL9+J1W\n" +
|
||||||
|
"ln1myRpff/5ZOAnZTPHR+AbX4bRB4sK5zijQe4139Dn2oRYK+EIYoBAxFxSOzehP\n" +
|
||||||
|
"IQAA/2BCN5HryGjVff2t7Q6fVrQQS9hsMisszZl5rWwUOO6zETHCigQfEQgAPAUC\n" +
|
||||||
|
"Xf4KaQMLCQoJEJunidx21oSaBBUKCQgCFgECF4ACGwMCHgEWIQRx/9oARAnl3bDD\n" +
|
||||||
|
"6PGbp4ncdtaEmgAAYoUA/1VpxdR2wYT/pC8FrKsbmIxLJRLDNlED3ihivWp/B2e/\n" +
|
||||||
|
"AQCT2oi9zqbjprCKAnzoIYTGTil4yFfmeey8GjMOxUHz4M0mQ2Fyb2wgT2xkc3R5\n" +
|
||||||
|
"bGUgPGNhcm9sQG9wZW5wZ3AuZXhhbXBsZT7CigQTEQgAPAUCXf4KaQMLCQoJEJun\n" +
|
||||||
|
"idx21oSaBBUKCQgCFgECF4ACGwMCHgEWIQRx/9oARAnl3bDD6PGbp4ncdtaEmgAA\n" +
|
||||||
|
"UEwA/2TFwL0mymjCSaQH8KdQuygI+itpNggM+Y8FF8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4ncdtaEmgAA\n" +
|
||||||
|
"QSkA/3WEWqZxvZmpVxpEMxJWaGQRwUhGake8OhC1WfywCtarAQCLwfBsyEv5jBEi\n" +
|
||||||
|
"1FkOSekLi8WNMdUx3XMyvP8nJ65P2Q==\n" +
|
||||||
|
"=Xj8h\n" +
|
||||||
|
"-----END PGP PRIVATE KEY BLOCK-----\n";
|
||||||
|
|
||||||
|
private static final String CAROL_CERT = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" +
|
||||||
|
"\n" +
|
||||||
|
"xsPuBF3+CmgRDADZhdKTM3ms3XpXnQke83FgaIBtP1g1qhqpCfg50WiPS0kjiMC0\n" +
|
||||||
|
"OJz2vh59nusbBLzgI//Y1VMhKfIWYbqMcIY+lWbseHjl52rqW6AaJ0TH4NgVt7vh\n" +
|
||||||
|
"yVeJt0k/NnxvNhMd0587KXmfpDxrwBqc/l5cVB+p0rL8vs8kxojHXAi5V3koM0Uj\n" +
|
||||||
|
"REWs5Jpj/XU9LhEoyXZkeJC/pes1u6UKoFYn7dFIP49Kkd1kb+1bNfdPYtA0JpcG\n" +
|
||||||
|
"zYgeMNOvdWJwn43dNhxoeuXfmAEhA8LdzT0C0O+7akXOKWrfhXJ8MTBqvPgWZYx7\n" +
|
||||||
|
"MNuQx/ejIMZHl+Iaf7hG976ILH+NCGiKkhidd9GIuA/WteHiQbXLyfiQ4n8P12q9\n" +
|
||||||
|
"+4dq6ybUM65tnozRyyN+1m3rU2a/+Ly3JCh4TeO27w+cxMWkaeHyTQaJVMbMbDpX\n" +
|
||||||
|
"duVd32MA33UVNH5/KXMVczVi5asVjuKDSojJDV1QwX8izZNl1t+AI0L3balCabV0\n" +
|
||||||
|
"SFhlfnBEUj1my1sBAMOSO/I67BvBS3IPHZWXHjgclhs26mPzRlZLryAUWR2DDACH\n" +
|
||||||
|
"5fx+yUAdZ8Vu/2zWTHxwWJ/X6gGTLqa9CmfDq5UDqYFFzuWwN4HJ+ryOuak1CGwS\n" +
|
||||||
|
"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||
|
"hDkmx4iAhHJX9J/gX/hC6L3AzPNJqNPAKy20wYp/ruTbbwBolW/4ikWij460JrvB\n" +
|
||||||
|
"sm6Sp81A3ebaiN9XkJygLOyhGyhMieGulCYz6AahAFcECtPXGTcordV1mJth8yjF\n" +
|
||||||
|
"4gZfDQyg0nMW4Yr49yeFXcRMUw1yzN3Q9v2zzqDuFi2lGYTXYmVqLYzM9KbLO2Wx\n" +
|
||||||
|
"E/21xnBjLsl09l/FdA/bhdZq3t4/apbFOeQQ/j/AphvzWbsJnhG9Q7+d3VoDlz0g\n" +
|
||||||
|
"FiSduCYIAAq8dUOJNjrUTkZsL1pOIjhYjCMi2uiKS6RQkT6nvuumPF/D/VTnUGeZ\n" +
|
||||||
|
"wooEGBEIADwFAl3+CmkDCwkKCRCbp4ncdtaEmgQVCgkIAhYBAheAAhsMAh4BFiEE\n" +
|
||||||
|
"cf/aAEQJ5d2ww+jxm6eJ3HbWhJoAAEEpAP91hFqmcb2ZqVcaRDMSVmhkEcFIRmpH\n" +
|
||||||
|
"vDoQtVn8sArWqwEAi8HwbMhL+YwRItRZDknpC4vFjTHVMd1zMrz/JyeuT9k=\n" +
|
||||||
|
"=pa/S\n" +
|
||||||
|
"-----END PGP PUBLIC KEY BLOCK-----\n";
|
||||||
|
|
||||||
|
private static final String BOB_KEY = "-----BEGIN PGP PRIVATE KEY BLOCK-----\n" +
|
||||||
|
"Comment: Bob's OpenPGP Transferable Secret Key\n" +
|
||||||
|
"\n" +
|
||||||
|
"lQVYBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" +
|
||||||
|
"/seOXpgecTdOcVttfzC8ycIKrt3aQTiwOG/ctaR4Bk/t6ayNFfdUNxHWk4WCKzdz\n" +
|
||||||
|
"/56fW2O0F23qIRd8UUJp5IIlN4RDdRCtdhVQIAuzvp2oVy/LaS2kxQoKvph/5pQ/\n" +
|
||||||
|
"5whqsyroEWDJoSV0yOb25B/iw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HIp9jrsQ\n" +
|
||||||
|
"aS381gnYwNX6wE1aEikgtY91nqJjwPlibF9avSyYQoMtEqM/1UjTjB2KdD/MitK5\n" +
|
||||||
|
"fP0VpvuXpNYZedmyq4UOMwdkiNMGAOrfmOeT0olgLrTMT5H97Cn3Yxbk13uXHNu/\n" +
|
||||||
|
"ZUZZNe8s+QtuLfUlKAJtLEUutN33TlWQY522FV0m17S+b80xJib3yZVJteVurrh5\n" +
|
||||||
|
"HSWHAM+zghQAvCesg5CLXa2dNMkTCmZKgCBvfDLZuZbjFwnwCI6u/NhOY9egKuUf\n" +
|
||||||
|
"SA/je/RXaT8m5VxLYMxwqQXKApzD87fv0tLPlVIEvjEsaf992tFEFSNPcG1l/jpd\n" +
|
||||||
|
"5AVXw6kKuf85UkJtYR1x2MkQDrqY1QX/XMw00kt8y9kMZUre19aCArcmor+hDhRJ\n" +
|
||||||
|
"E3Gt4QJrD9z/bICESw4b4z2DbgD/Xz9IXsA/r9cKiM1h5QMtXvuhyfVeM01enhxM\n" +
|
||||||
|
"GbOH3gjqqGNKysx0UODGEwr6AV9hAd8RWXMchJLaExK9J5SRawSg671ObAU24SdY\n" +
|
||||||
|
"vMQ9Z4kAQ2+1ReUZzf3ogSMRZtMT+d18gT6L90/y+APZIaoArLPhebIAGq39HLmJ\n" +
|
||||||
|
"26x3z0WAgrpA1kNsjXEXkoiZGPLKIGoe3hqJAbYEGAEKACAWIQTRpm4aI7GCyZgP\n" +
|
||||||
|
"eIz7/MgqAV5zMAUCXaWc8gIbDAAKCRD7/MgqAV5zMOn/C/9ugt+HZIwX308zI+QX\n" +
|
||||||
|
"c5vDLReuzmJ3ieE0DMO/uNSC+K1XEioSIZP91HeZJ2kbT9nn9fuReuoff0T0Dief\n" +
|
||||||
|
"rbwcIQQHFFkrqSp1K3VWmUGp2JrUsXFVdjy/fkBIjTd7c5boWljv/6wAsSfiv2V0\n" +
|
||||||
|
"JSM8EFU6TYXxswGjFVfc6X97tJNeIrXL+mpSmPPqy2bztcCCHkWS5lNLWQw+R7Vg\n" +
|
||||||
|
"71Fe6yBSNVrqC2/imYG2J9zlowjx1XU63Wdgqp2Wxt0l8OmsB/W80S1fRF5G4SDH\n" +
|
||||||
|
"s9HXglXXqPsBRZJYfP+VStm9L5P/sKjCcX6WtZR7yS6G8zj/X767MLK/djANvpPd\n" +
|
||||||
|
"NVniEke6hM3CNBXYPAMhQBMWhCulcoz+0lxi8L34rMN+Dsbma96psdUrn7uLaB91\n" +
|
||||||
|
"6we0CTfF8qqm7BsVAgalon/UUiuMY80U3ueoj3okiSTiHIjD/YtpXSPioC8nMng7\n" +
|
||||||
|
"xqAY9Bwizt4FWgXuLm1a4+So4V9j1TRCXd12Uc2l2RNmgDE=\n" +
|
||||||
|
"=miES\n" +
|
||||||
|
"-----END PGP PRIVATE KEY BLOCK-----\n";
|
||||||
|
|
||||||
|
private static final String BOB_CERT = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" +
|
||||||
|
"Comment: Bob's OpenPGP certificate\n" +
|
||||||
|
"\n" +
|
||||||
|
"mQGNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" +
|
||||||
|
"/seOXpgecTdOcVttfzC8ycIKrt3aQTiwOG/ctaR4Bk/t6ayNFfdUNxHWk4WCKzdz\n" +
|
||||||
|
"/56fW2O0F23qIRd8UUJp5IIlN4RDdRCtdhVQIAuzvp2oVy/LaS2kxQoKvph/5pQ/\n" +
|
||||||
|
"5whqsyroEWDJoSV0yOb25B/iwk/pLUFoyhDG9bj0kIzDxrEqW+7Ba8nocQlecMF3\n" +
|
||||||
|
"X5KMN5kp2zraLv9dlBBpWW43XktjcCZgMy20SouraVma8Je/ECwUWYUiAZxLIlMv\n" +
|
||||||
|
"9CurEOtxUw6N3RdOtLmYZS9uEnn5y1UkF88o8Nku890uk6BrewFzJyLAx5wRZ4F0\n" +
|
||||||
|
"qV/yq36UWQ0JB/AUGhHVPdFf6pl6ea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fdg8AyFAExaEK6Vy\n" +
|
||||||
|
"jP7SXGLwvfisw34OxuZr3qmx1Sufu4toH3XrB7QJN8XyqqbsGxUCBqWif9RSK4xj\n" +
|
||||||
|
"zRTe56iPeiSJJOIciMP9i2ldI+KgLycyeDvGoBj0HCLO3gVaBe4ubVrj5KjhX2PV\n" +
|
||||||
|
"NEJd3XZRzaXZE2aAMQ==\n" +
|
||||||
|
"=NXei\n" +
|
||||||
|
"-----END PGP PUBLIC KEY BLOCK-----\n";
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void regressionTest() throws IOException {
|
||||||
|
SOPImpl sop = new SOPImpl();
|
||||||
|
byte[] msg = "Hello, World!\n".getBytes();
|
||||||
|
Ready encryption = sop.encrypt()
|
||||||
|
.signWith(CAROL_KEY.getBytes())
|
||||||
|
.withCert(BOB_CERT.getBytes())
|
||||||
|
.plaintext(msg);
|
||||||
|
byte[] ciphertext = encryption.getBytes();
|
||||||
|
|
||||||
|
ByteArrayAndResult<DecryptionResult> decryption = sop.decrypt()
|
||||||
|
.withKey(BOB_KEY.getBytes())
|
||||||
|
.verifyWithCert(CAROL_CERT.getBytes())
|
||||||
|
.ciphertext(ciphertext)
|
||||||
|
.toByteArrayAndResult();
|
||||||
|
|
||||||
|
byte[] plaintext = decryption.getBytes();
|
||||||
|
assertArrayEquals(msg, plaintext);
|
||||||
|
assertEquals(1, decryption.getResult().getVerifications().size());
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,18 +6,21 @@ package org.pgpainless.sop;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import org.bouncycastle.openpgp.PGPException;
|
||||||
|
import org.bouncycastle.openpgp.PGPSecretKey;
|
||||||
import org.bouncycastle.openpgp.PGPSecretKeyRing;
|
import org.bouncycastle.openpgp.PGPSecretKeyRing;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.pgpainless.PGPainless;
|
import org.pgpainless.PGPainless;
|
||||||
import org.pgpainless.key.info.KeyRingInfo;
|
import org.pgpainless.key.info.KeyRingInfo;
|
||||||
|
import org.pgpainless.key.protection.UnlockSecretKey;
|
||||||
|
import org.pgpainless.util.Passphrase;
|
||||||
import sop.SOP;
|
import sop.SOP;
|
||||||
import sop.exception.SOPGPException;
|
|
||||||
|
|
||||||
public class GenerateKeyTest {
|
public class GenerateKeyTest {
|
||||||
|
|
||||||
|
@ -28,11 +31,6 @@ public class GenerateKeyTest {
|
||||||
sop = new SOPImpl();
|
sop = new SOPImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testMissingUserId() {
|
|
||||||
assertThrows(SOPGPException.MissingArg.class, () -> sop.generateKey().generate());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void generateKey() throws IOException {
|
public void generateKey() throws IOException {
|
||||||
byte[] bytes = sop.generateKey()
|
byte[] bytes = sop.generateKey()
|
||||||
|
@ -74,4 +72,24 @@ public class GenerateKeyTest {
|
||||||
|
|
||||||
assertFalse(new String(bytes).startsWith("-----BEGIN PGP PRIVATE KEY BLOCK-----"));
|
assertFalse(new String(bytes).startsWith("-----BEGIN PGP PRIVATE KEY BLOCK-----"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void protectedMultiUserIdKey() throws IOException, PGPException {
|
||||||
|
byte[] bytes = sop.generateKey()
|
||||||
|
.userId("Alice")
|
||||||
|
.userId("Bob")
|
||||||
|
.withKeyPassword("sw0rdf1sh")
|
||||||
|
.generate()
|
||||||
|
.getBytes();
|
||||||
|
|
||||||
|
PGPSecretKeyRing secretKey = PGPainless.readKeyRing().secretKeyRing(bytes);
|
||||||
|
KeyRingInfo info = PGPainless.inspectKeyRing(secretKey);
|
||||||
|
|
||||||
|
assertTrue(info.getUserIds().contains("Alice"));
|
||||||
|
assertTrue(info.getUserIds().contains("Bob"));
|
||||||
|
|
||||||
|
for (PGPSecretKey key : secretKey) {
|
||||||
|
assertNotNull(UnlockSecretKey.unlockSecretKey(key, Passphrase.fromPassword("sw0rdf1sh")));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
ext {
|
ext {
|
||||||
shortVersion = '1.3.14'
|
shortVersion = '1.3.17'
|
||||||
isSnapshot = true
|
isSnapshot = false
|
||||||
pgpainlessMinAndroidSdk = 10
|
pgpainlessMinAndroidSdk = 10
|
||||||
javaSourceCompatibility = 1.8
|
javaSourceCompatibility = 1.8
|
||||||
bouncyCastleVersion = '1.72'
|
bouncyCastleVersion = '1.72'
|
||||||
|
@ -13,11 +13,11 @@ allprojects {
|
||||||
// unfortunately we rely on 1.72.1 or 1.72.3 for a patch for https://github.com/bcgit/bc-java/issues/1257
|
// unfortunately we rely on 1.72.1 or 1.72.3 for a patch for https://github.com/bcgit/bc-java/issues/1257
|
||||||
// which is a bug we introduced with a PR against BC :/ oops
|
// which is a bug we introduced with a PR against BC :/ oops
|
||||||
// When bouncyCastleVersion is 1.71, bouncyPgVersion can simply be set to 1.71 as well.
|
// When bouncyCastleVersion is 1.71, bouncyPgVersion can simply be set to 1.71 as well.
|
||||||
bouncyPgVersion = '1.72.1'
|
bouncyPgVersion = '1.72.3'
|
||||||
junitVersion = '5.8.2'
|
junitVersion = '5.8.2'
|
||||||
logbackVersion = '1.2.11'
|
logbackVersion = '1.2.11'
|
||||||
mockitoVersion = '4.5.1'
|
mockitoVersion = '4.5.1'
|
||||||
slf4jVersion = '1.7.36'
|
slf4jVersion = '1.7.36'
|
||||||
sopJavaVersion = '4.0.7'
|
sopJavaVersion = '4.1.0'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue