1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2025-09-09 10:19:39 +02:00

Compare commits

..

265 commits

Author SHA1 Message Date
2ed16e8f52
KeyRingInfo: Pass API instance to key constructors 2025-08-20 11:41:35 +02:00
75093de961
Issue templates: Add question about AI tooling 2025-08-20 11:41:34 +02:00
312c47c473
Turn var into val 2025-08-20 11:41:34 +02:00
b30f0fd76a
Add overridden @Deprecated annotations 2025-08-20 11:41:34 +02:00
1c7f869bf7
Bump dependencies 2025-08-20 11:41:34 +02:00
d313b87fee
Bump sop-java to 14.0.0 2025-08-20 11:41:34 +02:00
74661f17ed
Bump sop-java to 14.0.0-SNAPSHOT 2025-08-20 11:41:33 +02:00
c9b562fde5
Bump BC to 1.81 + BC/#2105 2025-08-20 11:41:33 +02:00
e611311f2c
EncryptImpl: Emit session-key 2025-08-20 11:41:33 +02:00
fdcdf6270f
Add test for PolicyAdapter properly adapting NotationRegistry implementations 2025-08-20 11:41:33 +02:00
8d00ecf3fc
Add tests for SignatureSubpacketsCallback implementations 2025-08-20 11:41:33 +02:00
319847d4a8
setPreferredAEADCiphersuites(): Add missing method taking PreferredAEADCiphersuites object 2025-08-20 11:41:32 +02:00
1106cb4228
Add missing implementations of then() method 2025-08-20 11:41:32 +02:00
1ee77f1db7
Remove unused SignatureSubpackets callback related methods 2025-08-20 11:41:32 +02:00
19534fef09
Implement update-key command properly 2025-08-20 11:41:32 +02:00
d18158ac83
Add test for CompressionAlgorithmNegotiator 2025-08-20 11:41:32 +02:00
6429e3f77c
Move SymmetricKeyAlgorithmNegotiatorTest to negotiation package 2025-08-20 11:41:32 +02:00
fa289e9ca2
Swappable algorithm negotiation delegates 2025-08-20 11:41:31 +02:00
91730fd13f
SOP encrypt --profile=rfc9580: Only override enc mechanism with seipd2 if exclusively symmetric encryption is used 2025-08-20 11:41:31 +02:00
8290c7a3de
EncryptionMechanismNegotiator: Allow producing AEADED/OED packets 2025-08-20 11:41:31 +02:00
b10b65d7cc
ValidateUserIdImpl: throw CertUserIdNoMatch for unbound user-ids 2025-08-20 11:41:31 +02:00
e988796ea9
SOP encrypt: Add profile for rfc9580 2025-08-20 11:41:31 +02:00
d8a1a272d9
Enable additional profiles 2025-08-20 11:41:30 +02:00
330e7eaee8
SOP generate-key: Implement additional profiles 2025-08-20 11:41:30 +02:00
e280aa34a0
SOP generate-key: Add rfc9580 profile 2025-08-20 11:41:30 +02:00
8623352bf2
Move EncryptionMechanismNegotiator into own interface, improve negotiation 2025-08-20 11:41:30 +02:00
33ea12adbf
Replace usage of KeyIdentifier.matches() with matchesExplicitly() 2025-08-20 11:41:30 +02:00
c8bad83346
Remove SignerUserIdValidation enum 2025-08-20 11:41:30 +02:00
34766abdfb
Add deprecation notices 2025-08-20 11:41:29 +02:00
5c0cdfd494
WIP: EncryptionMechanismPolicy 2025-08-20 11:41:29 +02:00
de7c2ea633
Improve GnuPGDummyKeyUtilTest 2025-08-20 11:41:29 +02:00
2afa614731
Test v6 key revocation 2025-08-20 11:41:29 +02:00
a46f170636
Test edge-cases in inline-detach operation 2025-08-20 11:41:29 +02:00
1395653698
Document KOpenPGP mitigations 2025-08-20 11:41:28 +02:00
c99402dc3c
Simplify SessionKey conversion 2025-08-20 11:41:28 +02:00
197c1337c6
Document KOpenPGP mitigations 2025-08-20 11:41:28 +02:00
30de257d46
Fix more javadoc references 2025-08-20 11:41:28 +02:00
ca1dfae86f
Fix references in javadoc 2025-08-20 11:41:28 +02:00
92d66f7f30
Add OpenPGPCertificateUtil and unify the way, SOP encodes/armors certificates/keys 2025-08-20 11:41:27 +02:00
b8841a4415
KeyRingReaderTest: Remove unused import 2025-08-20 11:41:27 +02:00
66d270c071
TestAllImplementations: Fix javadoc 2025-08-20 11:41:27 +02:00
af500bdec1
Fix test 2025-08-20 11:41:27 +02:00
e552255aa6
Generate-Key: Use new packet tags 2025-08-20 11:41:27 +02:00
963e442b3c
Add missing license headers 2025-08-20 11:41:26 +02:00
d839e2eed1
Add documentation 2025-08-20 11:41:26 +02:00
2014db4112
Update documentation of AEADAlgorithm 2025-08-20 11:41:26 +02:00
8b9d41004b
Port CertificateAuthority to KeyIdentifier, add tests for authenticated cert selection 2025-08-20 11:41:26 +02:00
302e690b44
Add tests for LongExtension methods 2025-08-20 11:41:26 +02:00
71168d2091
Add test and documentation to DateExtensions 2025-08-20 11:41:26 +02:00
070780675e
Some updates to the README file 2025-08-20 11:41:25 +02:00
f694720c97
Add AEADAlkgorithm.toMechanism(SymAlg) shortcut method 2025-08-20 11:41:25 +02:00
9d75026bab
Update README 2025-08-20 11:41:25 +02:00
be5c2a01a1
Port GnuPGDummyExtension implementation 2025-08-20 11:41:25 +02:00
0e6fa4b619
Port Exception classes to Kotlin 2025-08-20 11:41:25 +02:00
aaf88b8d3e
Remove usage of OpenPgpKeyAttributeUtil 2025-08-20 11:41:25 +02:00
702db4d75c
Port OpenPGPInputStream to Kotlin as OpenPGPAnimalSnifferInputStream 2025-08-20 11:41:24 +02:00
3a0ee1c101
Typo 2025-08-20 11:41:24 +02:00
8cb94a8924
Clean up OnePassSignatureCheck 2025-08-20 11:41:24 +02:00
3340614595
Remove unused SignatureComparator classes 2025-08-20 11:41:24 +02:00
02a997fb26
Fix comment block layout 2025-08-20 11:41:24 +02:00
380191c35b
Update documentation of SignatureVerification 2025-08-20 11:41:23 +02:00
3ccc8601d7
Rework ASCII armor API 2025-08-20 11:41:23 +02:00
9856aa43c4
Add documentation to PGPainless class 2025-08-20 11:41:23 +02:00
9ed53308c6
Replace static decryptAndOrVerify() method with non-static processMessage() function 2025-08-20 11:41:23 +02:00
7062681d03
Prevent NULL encryption algorithm 2025-08-20 11:41:23 +02:00
620f35cdd1
Test encryptionMechanismOverride for symmetric and asymmetric encryption 2025-08-20 11:41:23 +02:00
af7b0a8a5f
Respect encryptionMechanismOverride 2025-08-20 11:41:22 +02:00
6fec51c91c
Remove debugging prints 2025-08-20 11:41:22 +02:00
3729e0fa6d
Add documentation 2025-08-20 11:41:22 +02:00
5afd22b219
Rework OpenPGPInputStream to rely on BCPGInputStream for packet parsing 2025-08-20 11:41:22 +02:00
bc3cb95945
Workaround for OpenPGPInputStream to recognize PKESKv6 packets 2025-08-20 11:41:22 +02:00
42a3082568
Fix checkstyle issues 2025-08-20 11:41:21 +02:00
75174ae7a1
Move negotiation tests to dedicated test class 2025-08-20 11:41:21 +02:00
b41fb2c468
First draft for SEIPD2 negotiation 2025-08-20 11:41:21 +02:00
7a33e84497
Rework KeyAccessor 2025-08-20 11:41:21 +02:00
ef9fed2844
Expose encryption mechanism during decryption 2025-08-20 11:41:21 +02:00
3f6d4755e0
Add BUILD.md 2025-08-20 11:41:21 +02:00
9ba39045a7
Update README 2025-08-20 11:41:20 +02:00
661d4977eb
Raise kotlin lib version 2025-08-20 11:41:20 +02:00
90dce46b8d
Remove duplicate line in build.gradle 2025-08-20 11:41:20 +02:00
239057cbdf
Implement crude update-key command (only merges certs for now) 2025-08-20 11:41:20 +02:00
1fca2dcb13
SOP certify-userid: Properly throw KeyCannotCertify exception 2025-08-20 11:41:20 +02:00
7a36735162
Add PGPainlessCertifyValidateUserIdTest 2025-08-20 11:41:19 +02:00
c60512a26d
Certify-UserId: Throw proper exception on unbound user-id 2025-08-20 11:41:19 +02:00
7d4c6a06b0
Set relaxed PK policies for tests with weak DSA keys 2025-08-20 11:41:19 +02:00
2c11a141d7
Fix checkstyle issues 2025-08-20 11:41:19 +02:00
151e0232c0
Add comments 2025-08-20 11:41:19 +02:00
b2d8935fc8
SOP: Implement merge-certs subcommand 2025-08-20 11:41:19 +02:00
2d379f6fc8
Update SOP version in VersionImpl 2025-08-20 11:41:18 +02:00
334147c840
Add PublicKeyAlgorithmPolicy based on rfc9580 2025-08-20 11:41:18 +02:00
6c0ffcb007
Implement SOPs validate-userid command 2025-08-20 11:41:18 +02:00
f4cac6d20c
Implement SOPs certify-userid command 2025-08-20 11:41:18 +02:00
5829b755ed
SOP-Java: These go to 11 2025-08-20 11:41:18 +02:00
8819ba0201
HardwareSecurity: Replace usage of Long KeyId with KeyIdentifier 2025-08-20 11:41:17 +02:00
f42f60b970
Remove unused test 2025-08-20 11:41:17 +02:00
ec86391d03
Port ReadKeys example 2025-08-20 11:41:17 +02:00
dad4e28580
Port Encrypt example 2025-08-20 11:41:17 +02:00
a973e84d83
Port DecryptOrVerify example 2025-08-20 11:41:17 +02:00
cb7c27751a
Port EncryptDecryptTest 2025-08-20 11:41:17 +02:00
335cf8d162
Improve API for signatures in results 2025-08-20 11:41:16 +02:00
049f7422c0
Replace all remaining usages of PGPainless.generateKeyRing() 2025-08-20 11:41:16 +02:00
686244a730
Add tests for v6<->v4 certificate certification 2025-08-20 11:41:16 +02:00
8c291c8c45
Port KeyWithUnknownSecretKeyEncryptionMethodTest 2025-08-20 11:41:16 +02:00
f79aba74ed
Port a bunch of more tests 2025-08-20 11:41:16 +02:00
674b15637f
Add missing methods for SecretKeyRing protection 2025-08-20 11:41:16 +02:00
2d678f8bb9
Add OpenPGPSecretKey.unlock(Passphrase) extension method 2025-08-20 11:41:15 +02:00
46d58f230e
Port BcHashContextSigner and test 2025-08-20 11:41:15 +02:00
0963f110a4
Port TryDecryptWithUnavailableGnuDummyKeyTest 2025-08-20 11:41:15 +02:00
bad49de6aa
Port more tests 2025-08-20 11:41:15 +02:00
c0207f50e9
Port some more tests 2025-08-20 11:41:15 +02:00
f6284fd59b
Port UnlockSecretKey method 2025-08-20 11:41:14 +02:00
9c87e4f34f
Small javadoc fixes 2025-08-20 11:41:14 +02:00
cf4ba07fbc
Add test for overriding features during key generation 2025-08-20 11:41:14 +02:00
b84f464b49
KeySpecBuilder: Expose API for overriding default AEAD algorithms and features 2025-08-20 11:41:14 +02:00
92630e40a4
Add missing javadoc to SigningOptions 2025-08-20 11:41:14 +02:00
0152a69d0e
Remove API instance parameter from ProducerOptions 2025-08-20 11:41:13 +02:00
9894524e33
Port ConvertKeys example 2025-08-20 11:41:13 +02:00
9204df5343
Port GenerateKeys examples 2025-08-20 11:41:13 +02:00
c1c54be259
Port PGPPublicKeyRingTest 2025-08-20 11:41:13 +02:00
0450e0cb81
Port ExtractCertCmdTest 2025-08-20 11:41:13 +02:00
2a0e4e1d2d
generate-key: Use API instance when generating keys 2025-08-20 11:41:13 +02:00
5e3f6a1d47
Migrate GenerateKeyWithoutUserIdTest 2025-08-20 11:41:12 +02:00
6273f93d59
Migrate some tests to new API 2025-08-20 11:41:12 +02:00
4260ed7969
IntegrityProtectedInputStream: remove useless logger 2025-08-20 11:41:12 +02:00
797f421b27
Remove SignatureValidator methods 2025-08-20 11:41:12 +02:00
44c85fd1f4
Remove unused SignatureValidator methods 2025-08-20 11:41:12 +02:00
08ac0e874b
Replace SignatureVerifier usage with BC API 2025-08-20 11:41:11 +02:00
85c0286041
Remove usage of deprecated methods in SOP implementations 2025-08-20 11:41:11 +02:00
aeed0e736b
Port MessageInspector 2025-08-20 11:41:11 +02:00
a5336b1806
KeyRingUtils: Use KeyIdentifier instead of keyId 2025-08-20 11:41:11 +02:00
d721f546b6
KeyRingReader: Replace usage of deprecated PGPainless method with BC method 2025-08-20 11:41:11 +02:00
05300e3209
Improve readability of OpenPGPMessageInputStream 2025-08-20 11:41:11 +02:00
8b0057f266
Remove duplicate Padding parser branch 2025-08-20 11:41:10 +02:00
fe981e0384
Replace KeyRingUtils usage with toCertificate() 2025-08-20 11:41:10 +02:00
b4cff6d295
KeyRingInfo: Apply latest method name change from BC 2025-08-20 11:41:10 +02:00
fa9d769c5a
Rename new CertifyCertificate API methods and add revocation methods 2025-08-20 11:41:10 +02:00
8621ae8a69
Test v6 third party certification generation 2025-08-20 11:41:10 +02:00
9540d6090e
CertifyCertificate: Change visibility of internal members to private 2025-08-20 11:41:09 +02:00
529d344547
Remove Tuple class 2025-08-20 11:41:09 +02:00
970e974556
Remove unused KeyRingSelectionStrategy implementations 2025-08-20 11:41:09 +02:00
6a9fb3f6df
Rework some more tests 2025-08-20 11:41:09 +02:00
d5151b804e
Port SigningTest 2025-08-20 11:41:09 +02:00
288375212c
Introduce PGPainless.toKeyOrCertificate(PGPKeyRing) and constrain argument type of PGPainless.toCertificate(PGPPublicKeyRing) 2025-08-20 11:41:09 +02:00
8f3049602f
Remove SignerUserId check, Policy setting only via constructor parameter 2025-08-20 11:41:08 +02:00
b97ff5bc4e
Port signature validation to BC 2025-08-20 11:41:08 +02:00
c87941a41d
Rework ModifiedPublicKeysInvestigation 2025-08-20 11:41:08 +02:00
14a16575a4
Avoid usage of PGPainless.getPolicy() 2025-08-20 11:41:08 +02:00
772ffe5f5a
KeySpecBuilder: Do not use PGPainless.getPolicy() method 2025-08-20 11:41:08 +02:00
f2bd36502f
Policy is no longer a Singleton 2025-08-20 11:41:07 +02:00
1afcbacb04
Determine, whether to use AEAD by cosulting KeyRingProtectionSettings 2025-08-20 11:41:07 +02:00
6f3808466f
Port SelectUserId.validUserIds() 2025-08-20 11:41:07 +02:00
aabc8aa3a1
Change argument type for toCertificate() method to more general PGPKeyRing 2025-08-20 11:41:07 +02:00
264eb1c8a6
Delete SignaturePicker class 2025-08-20 11:41:07 +02:00
dc1da5ff49
Fix test name 2025-08-20 11:41:07 +02:00
efc20145b1
Port more extension functions 2025-08-20 11:41:06 +02:00
fad3974b21
Migrate some extension functions 2025-08-20 11:41:06 +02:00
6d25ddefab
PGPSignatureExtensions: Port wasIssuedBy() to KeyIdentifier 2025-08-20 11:41:06 +02:00
24f871c178
Update some examples in the README file 2025-08-20 11:41:06 +02:00
766a22716e
SOP: Inject API instance 2025-08-20 11:41:06 +02:00
4c7d39932f
Port SecretKeyRingEditor, replace Singleton usage with API instance calls 2025-08-20 11:41:03 +02:00
21a167ce24
Add more deprecation annotations, workaround for BC armor bug 2025-08-20 11:40:13 +02:00
777ecb9ee7
GnuPGDummyKeyUtil: Migrate to KeyIdentifier 2025-08-20 11:40:13 +02:00
5f64e92724
Remove ProviderFactory classes
It is no longer possible to inject custom SecurityProviders.
Instead, you can create and inject your own implementation of BCs OpenPGPImplementation
2025-08-20 11:40:13 +02:00
6951911520
Fix javadoc parameter names 2025-08-20 11:40:13 +02:00
e68c365296
UserId: Remove deprecated method usage 2025-08-20 11:40:12 +02:00
e7954ff6f1
KeyRingUtils: Replace deprecated method usage 2025-08-20 11:40:12 +02:00
b543c2ed2a
Replace deprecated method usage and make policy injectable in UnlockSecretKey utility class 2025-08-20 11:40:12 +02:00
2f6e9abf23
Remove deprecated KeyInfo class
If you relied on it, replace its usage with the Kotlin extension functions as documented.
If you are using Java, use static methods from PGPPublicKeyExtensionsKt and PGPSecretKeyExtensionsKt instead.
2025-08-20 11:40:12 +02:00
3ea51f77be
Move default parameters of Options classes to factory methods 2025-08-20 11:40:12 +02:00
2489237071
ConsumerOptions: Pass down API 2025-08-20 11:40:12 +02:00
35b0cdde7e
More API down-handing 2025-08-20 11:40:11 +02:00
37f6fd100a
Cleanup PGPainless class 2025-08-20 11:40:11 +02:00
b9d7f1281f
Pass down API instance in more places 2025-08-20 11:40:11 +02:00
17c31349a1
Pass down API instance 2025-08-20 11:40:11 +02:00
2ae2389666
More code cleanup 2025-08-20 11:40:11 +02:00
a0624d8ac1
Add documentation 2025-08-20 11:40:10 +02:00
1fee94bf93
Code cleanup 2025-08-20 11:40:10 +02:00
9c591ef6d1
Allow passing creation time into KeyRingTemplates, replace deprecated methods 2025-08-20 11:40:10 +02:00
4f7aea6019
Fix GenerateV6KeyTest.generateAEADProtectedModernKey() test 2025-08-20 11:40:10 +02:00
e46e9fa1f5
Rework Policy to be immutable. Changes are now done by calling policy.copy().withXYZ().build() 2025-08-20 11:40:10 +02:00
abff76de38
PublicKeyAlgorithms: Update documentation 2025-08-20 11:40:09 +02:00
38df5ee36e
PublicKeyAlgorithm: Ask PublicKeyUtils for algorithm capabilities, add persistent symmetric key algorithm ids 2025-08-20 11:40:09 +02:00
14bfd52191
Add OpenPGPImplementation.checksumCalculator() extension function 2025-08-20 11:40:09 +02:00
502a755f20
Replace usage of .let() 2025-08-20 11:40:09 +02:00
b1855d0a13
Make secret key protection settings customizable via policy 2025-08-20 11:40:09 +02:00
671dde0de9
Copy deprecation annotation 2025-08-20 11:40:08 +02:00
27edbd1682
Rename parameter 2025-08-20 11:40:08 +02:00
8a2b8c0ef0
Use relaxed PBE parameters 2025-08-20 11:40:08 +02:00
36abac5fb3
WIP: Migrate SecretKeyRingEditor 2025-08-20 11:40:08 +02:00
8c18cfc74e
Transform SignatureSubpackets class into simple wrapper around PGPSignatureSubpacketGenerator 2025-08-20 11:40:08 +02:00
f30b01c298
Avoid deprecated API and remove unnecessary code 2025-08-20 11:40:07 +02:00
622c62536a
Tests: Avoid usage of now deprecated functionality 2025-08-20 11:40:07 +02:00
76963ec3ec
Remove ImplementationFactory in favor of BCs OpenPGPImplementation 2025-08-20 11:40:07 +02:00
0bc80d86d3
SigningOptions: Properly init PGPSignatureGenerator to support v6 keys 2025-08-20 11:40:07 +02:00
d28b47c1f1
Policy: Change default compression algorithm to UNCOMPRESSED 2025-08-20 11:40:07 +02:00
4dadc7c445
Implement applying algorithm preferences as extension functions 2025-08-20 11:40:06 +02:00
deaf9fa404
buildKey(): Use BC KeyGenerator, but apply PGPainless algorithm preferences 2025-08-20 11:40:06 +02:00
b5386d844e
Add missing method implementations 2025-08-20 11:40:06 +02:00
1141bdf1f8
Work on AlgorithmSuite 2025-08-20 11:40:06 +02:00
5ccd68cdd9
Fix: Do not set IssuerKeyId on v6 key-signatures 2025-08-20 11:40:06 +02:00
350b67bb9e
Progress on the migration guide 2025-08-20 11:40:05 +02:00
b3c088275e
Start working on migration guide 2025-08-20 11:40:05 +02:00
8e3ad2c9ef
Add some missing documentation to ConsumerOptions 2025-08-20 11:40:05 +02:00
1e2e9c2125
Rework OnePassSignatureCheck 2025-08-20 11:40:05 +02:00
3c28660f26
Add documentation to PolicyAdapter 2025-08-20 11:40:05 +02:00
d955341231
Add getKeyVersion() extension methods to certificate + subclasses and use it in KeyRingInfo.version 2025-08-20 11:40:05 +02:00
853de42bc2
Fix more spotless formatting errors 2025-08-20 11:40:04 +02:00
7af4689bb7
Fix spotless error 2025-08-20 11:40:04 +02:00
b563e43c78
Add comments to OpenPGPKeyVersion 2025-08-20 11:40:04 +02:00
a23e573658
Add comments to HashAlgorithm 2025-08-20 11:40:04 +02:00
b9ee09a774
Add javadoc 2025-08-20 11:40:04 +02:00
b8bdb5bbe5
Clean up KeyAccessor class 2025-08-20 11:40:03 +02:00
f37d4a4450
Complete migration of KeyRingInfo to KeyIdentifier, javadoc 2025-08-20 11:40:03 +02:00
c886b56faf
Replace KeyRingInfo.publicKey with primaryKey 2025-08-20 11:40:03 +02:00
6eaa483650
Improve KeyRingInfos getPreferences implementations 2025-08-20 11:40:03 +02:00
35c6116643
Migrate from MissingPublicKeyCallback to OpenPGPCertifcateProvider 2025-08-20 11:40:03 +02:00
2eca5f0ef0
Fix addSubkey method 2025-08-20 11:40:03 +02:00
d5a0c83abe
Fix some tests 2025-08-20 11:40:02 +02:00
8b41f80ca0
Port SignatureBuilders over to new classes 2025-08-20 11:40:02 +02:00
2f3b1fac95
Rename and document members of SubkeyIdentifier 2025-08-20 11:40:02 +02:00
259a77d4df
OpenPGPFingerprint(s): Use FingerprintUtil to calculate key-ids 2025-08-20 11:40:02 +02:00
79bbea593e
Remove unnecessary imports 2025-08-20 11:40:02 +02:00
cb440776f2
Add workaround for decryption with non-encryption subkey 2025-08-20 11:40:02 +02:00
ce65e406c1
Fix version 2025-08-20 11:40:01 +02:00
8936cf22d0
Port CanonicalizedDataEncryptionTest 2025-08-20 11:40:01 +02:00
e3c586e182
Port Sign and UnlockSecretKeys examples 2025-08-20 11:40:01 +02:00
7e9b8d1cee
Port ReadKeys example 2025-08-20 11:40:01 +02:00
31dddb9de1
Progress porting the example tests 2025-08-20 11:40:01 +02:00
dcb78ddedf
Improve KeyExceptions 2025-08-20 11:40:00 +02:00
92da00fc8c
OpenPGPFingerprint: Add factory methods for new key / subkey classes 2025-08-20 11:40:00 +02:00
acb5a4a550
Port test 2025-08-20 11:40:00 +02:00
30d584c696
Port EncryptionOptions over to OpenPGPCertificate 2025-08-20 11:40:00 +02:00
4a90b8721f
Port ConsumerOptions, SigningOptions to new OpenPGPCertificate, OpenPGPKey classes 2025-08-20 11:40:00 +02:00
bbecdd693f
Reenable disabled test and add workaround for broken one 2025-08-20 11:40:00 +02:00
504939d82b
Even more migration and code compiles again 2025-08-20 11:39:59 +02:00
95c475d140
WIP: Transform Options and OpenPgpMessageInputStream 2025-08-20 11:39:59 +02:00
b55aa24cad
Change return type of KeyRingBuilder.build() to OpenPGPKey 2025-08-20 11:39:59 +02:00
0cb7b8886a
WIP: Migrate away from static methods 2025-08-20 11:39:59 +02:00
e19119e4cb
Begin transition to instance-based PGPainless, adapt policy 2025-08-20 11:39:59 +02:00
ba042e2728
Tests: Remove unused throws declarations 2025-08-20 11:39:58 +02:00
d889d37de5
Fix tests 2025-08-20 11:39:58 +02:00
7217eda924
KeyRingInfo: Replace PGPainless signature evaluation with BCs 2025-08-20 11:39:58 +02:00
b8bb5de2a2
Disable ElGamal key tests 2025-08-20 11:39:58 +02:00
c40a0b91f9
KeyRingInfo: Expose OpenPGPComponentKey in place of PGPPublicKey, OpenPGPSecretKey instead of PGPSecretKey 2025-08-20 11:39:58 +02:00
137bb51f2c
Change type of KeyRingInfo.publicKey to OpenPGPPrimaryKey 2025-08-20 11:39:57 +02:00
c593b5a590
Further integration of OpenPGPCertificate into KeyRingInfo 2025-08-20 11:39:57 +02:00
002fa71bb7
Add some debug checks to test 2025-08-20 11:39:57 +02:00
2c0edf9588
Fix some tests 2025-08-20 11:39:57 +02:00
e20beb6755
Fix test stability 2025-08-20 11:39:57 +02:00
34c8921bed
Start porting KeyRingInfo over to OpenPGPCertificate 2025-08-20 11:39:57 +02:00
d4b16971d5
Integrate KeyIdentifier with SubkeyIdentifier 2025-08-20 11:39:56 +02:00
eb9efec7c9
Add missing license headers 2025-08-20 11:39:56 +02:00
fd3616061a
Basic v6 key generation test 2025-08-20 11:39:56 +02:00
a62d3aacd0
Add new key types to default policy 2025-08-20 11:39:56 +02:00
443361ba03
Add new key types X25519, X448, Ed25519, Ed448 2025-08-20 11:39:56 +02:00
d2532977cc
Pass version down in tests 2025-08-20 11:39:55 +02:00
626176cdad
Allow passing version number to key generator 2025-08-20 11:39:55 +02:00
69d65e763d
Simplify code for setExpirationDate() 2025-08-20 11:39:55 +02:00
6abc47a8e1
Adapt PGPKeyPairGenerator and remove support for generating ElGamal keys 2025-08-20 11:39:55 +02:00
119bfbb347
PGPainless 2.0.0-SNAPSHOT 2025-08-20 11:39:55 +02:00
02a5db3297
Bump bc to 1.80-SNAPSHOT, sop-java to 10.1.0-SNAPSHOT 2025-08-20 11:39:54 +02:00
0d807cb6b8
Fix typo in error message 2025-07-23 11:26:40 +02:00
9b0a3cd4c7
Do not trim passphrases automatically 2025-07-23 11:26:28 +02:00
0ee31b232a
Allow UserIDs with trailing/leading whitespace and escape newlines in ASCII armor 2025-07-23 11:26:17 +02:00
f2cbde43be
Update codeql action to v3 2025-07-01 10:54:06 +02:00
8 changed files with 37 additions and 17 deletions

View file

@ -36,7 +36,7 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'java' ]
language: [ 'java-kotlin' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support
@ -46,7 +46,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
@ -57,7 +57,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3
# Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
@ -71,4 +71,4 @@ jobs:
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3

View file

@ -38,6 +38,11 @@ abstract class KeyException : RuntimeException {
) {
constructor(cert: OpenPGPCertificate, expirationDate: Date) : this(of(cert), expirationDate)
constructor(
componentKey: OpenPGPComponentKey,
expirationDate: Date
) : this(of(componentKey), expirationDate)
}
class RevokedKeyException : KeyException {

View file

@ -52,7 +52,7 @@ class KeyRingBuilder(private val version: OpenPGPKeyVersion, private val api: PG
}
override fun addUserId(userId: CharSequence): KeyRingBuilder = apply {
userIds[userId.toString().trim()] = null
userIds[userId.toString()] = null
}
override fun addUserId(userId: ByteArray): KeyRingBuilder =

View file

@ -35,7 +35,8 @@ class KeyRingInfo(
api: PGPainless = PGPainless.getInstance(),
referenceDate: Date = Date()
) : this(
if (keys is PGPSecretKeyRing) OpenPGPKey(keys) else OpenPGPCertificate(keys),
if (keys is PGPSecretKeyRing) OpenPGPKey(keys, api.implementation)
else OpenPGPCertificate(keys, api.implementation),
api,
referenceDate)

View file

@ -532,7 +532,7 @@ class SecretKeyRingEditor(
val prevBinding =
api.inspect(key).getCurrentSubkeyBindingSignature(keyId)
?: throw NoSuchElementException(
"Previous subkey binding signaure for $keyId MUST NOT be null.")
"Previous subkey binding signature for $keyId MUST NOT be null.")
val bindingSig = reissueSubkeyBindingSignature(subkey, expiration, protector, prevBinding)
secretKeyRing =
injectCertification(secretKeyRing, subkey.pgpPublicKey, bindingSig.signature)
@ -624,9 +624,10 @@ class SecretKeyRingEditor(
}
private fun sanitizeUserId(userId: CharSequence): CharSequence =
// TODO: Further research how to sanitize user IDs.
// e.g. what about newlines?
userId.toString().trim()
// I'm not sure, what kind of sanitization is needed.
// Newlines are allowed, they just need to be escaped when emitted in an ASCII armor header
// Trailing/Leading whitespace is also fine.
userId.toString()
private fun callbackFromRevocationAttributes(attributes: RevocationAttributes?) =
object : RevocationSignatureSubpackets.Callback {

View file

@ -247,7 +247,8 @@ class ArmorUtils {
.add(OpenPgpFingerprint.of(publicKey).prettyPrint())
// Primary / First User ID
(primary ?: first)?.let {
headerMap.getOrPut(HEADER_COMMENT) { mutableSetOf() }.add(it)
headerMap.getOrPut(HEADER_COMMENT) { mutableSetOf() }
.add(it.replace("\n", "\\n").replace("\r", "\\r"))
}
// X-1 further identities
when (userIds.size) {

View file

@ -11,14 +11,9 @@ import org.bouncycastle.util.Arrays
*
* @param chars may be null for empty passwords.
*/
class Passphrase(chars: CharArray?) {
class Passphrase(private val chars: CharArray?) {
private val lock = Any()
private var valid = true
private val chars: CharArray?
init {
this.chars = trimWhitespace(chars)
}
/**
* Return a copy of the underlying char array. A return value of null represents an empty
@ -67,6 +62,13 @@ class Passphrase(chars: CharArray?) {
override fun hashCode(): Int = getChars()?.let { String(it) }.hashCode()
/**
* Return a copy of this [Passphrase], but with whitespace characters trimmed off.
*
* @return copy with trimmed whitespace
*/
fun withTrimmedWhitespace(): Passphrase = Passphrase(trimWhitespace(chars))
companion object {
/**

View file

@ -100,4 +100,14 @@ public class GenerateKeyTest {
assertThrows(SOPGPException.UnsupportedProfile.class, () ->
sop.generateKey().profile("invalid"));
}
@Test
public void generateKeyWithNewlinesInUserId() throws IOException {
byte[] keyBytes = sop.generateKey()
.userId("Foo\n\nBar")
.generate()
.getBytes();
assertTrue(new String(keyBytes).contains("Foo\\n\\nBar"));
}
}