mirror of
https://github.com/pgpainless/pgpainless.git
synced 2025-12-10 06:11:08 +01:00
Deprecate withMasterKey(spec) in favor of withPrimaryKey(spec)
This commit is contained in:
parent
10de44ebd3
commit
651bb63175
14 changed files with 35 additions and 23 deletions
|
|
@ -123,7 +123,7 @@ public class KeyRingBuilder implements KeyRingBuilderInterface {
|
|||
public PGPSecretKeyRing simpleRsaKeyRing(@Nonnull String userId, @Nonnull RsaLength length, String password)
|
||||
throws PGPException, NoSuchAlgorithmException, InvalidAlgorithmParameterException {
|
||||
WithAdditionalUserIdOrPassphrase builder = this
|
||||
.withMasterKey(
|
||||
.withPrimaryKey(
|
||||
KeySpec.getBuilder(KeyType.RSA(length))
|
||||
.withKeyFlags(KeyFlag.CERTIFY_OTHER, KeyFlag.SIGN_DATA, KeyFlag.ENCRYPT_COMMS)
|
||||
.withDefaultAlgorithms())
|
||||
|
|
@ -196,7 +196,7 @@ public class KeyRingBuilder implements KeyRingBuilderInterface {
|
|||
KeySpec.getBuilder(KeyType.XDH(XDHCurve._X25519))
|
||||
.withKeyFlags(KeyFlag.ENCRYPT_STORAGE, KeyFlag.ENCRYPT_COMMS)
|
||||
.withDefaultAlgorithms())
|
||||
.withMasterKey(
|
||||
.withPrimaryKey(
|
||||
KeySpec.getBuilder(KeyType.EDDSA(EdDSACurve._Ed25519))
|
||||
.withKeyFlags(KeyFlag.CERTIFY_OTHER, KeyFlag.SIGN_DATA)
|
||||
.withDefaultAlgorithms())
|
||||
|
|
@ -228,7 +228,7 @@ public class KeyRingBuilder implements KeyRingBuilderInterface {
|
|||
KeySpec.getBuilder(KeyType.EDDSA(EdDSACurve._Ed25519))
|
||||
.withKeyFlags(KeyFlag.SIGN_DATA)
|
||||
.withDefaultAlgorithms())
|
||||
.withMasterKey(
|
||||
.withPrimaryKey(
|
||||
KeySpec.getBuilder(KeyType.EDDSA(EdDSACurve._Ed25519))
|
||||
.withKeyFlags(KeyFlag.CERTIFY_OTHER)
|
||||
.withDefaultAlgorithms())
|
||||
|
|
@ -248,7 +248,7 @@ public class KeyRingBuilder implements KeyRingBuilderInterface {
|
|||
}
|
||||
|
||||
@Override
|
||||
public WithPrimaryUserId withMasterKey(@Nonnull KeySpec spec) {
|
||||
public WithPrimaryUserId withPrimaryKey(@Nonnull KeySpec spec) {
|
||||
verifyMasterKeyCanCertify(spec);
|
||||
|
||||
KeyRingBuilder.this.keySpecs.add(0, spec);
|
||||
|
|
|
|||
|
|
@ -28,7 +28,19 @@ public interface KeyRingBuilderInterface {
|
|||
|
||||
KeyRingBuilderInterface withSubKey(@Nonnull KeySpec keySpec);
|
||||
|
||||
WithPrimaryUserId withMasterKey(@Nonnull KeySpec keySpec);
|
||||
/**
|
||||
* Define the primary key spec.
|
||||
*
|
||||
* @deprecated use {@link #withPrimaryKey(KeySpec)} instead.
|
||||
* @param keySpec key spec
|
||||
* @return builder step
|
||||
*/
|
||||
@Deprecated
|
||||
default WithPrimaryUserId withMasterKey(@Nonnull KeySpec keySpec) {
|
||||
return withPrimaryKey(keySpec);
|
||||
}
|
||||
|
||||
WithPrimaryUserId withPrimaryKey(@Nonnull KeySpec keySpec);
|
||||
|
||||
interface WithPrimaryUserId {
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue