pgpainless/pgpainless-core/src/main/java/org/pgpainless/key/generation/KeyRingBuilderInterface.java

54 lines
1.5 KiB
Java
Raw Normal View History

/*
* Copyright 2018 Paul Schaub.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.pgpainless.key.generation;
2018-06-02 21:21:35 +02:00
import java.security.InvalidAlgorithmParameterException;
2018-06-02 21:21:35 +02:00
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import org.bouncycastle.openpgp.PGPException;
import org.pgpainless.key.collection.PGPKeyRing;
import org.pgpainless.util.Passphrase;
2018-06-02 21:21:35 +02:00
public interface KeyRingBuilderInterface {
KeyRingBuilderInterface withSubKey(KeySpec keySpec);
2018-06-02 21:21:35 +02:00
WithPrimaryUserId withMasterKey(KeySpec keySpec);
2018-06-02 21:21:35 +02:00
interface WithPrimaryUserId {
WithPassphrase withPrimaryUserId(String userId);
2018-06-02 21:21:35 +02:00
WithPassphrase withPrimaryUserId(byte[] userId);
2018-06-02 21:21:35 +02:00
}
interface WithPassphrase {
2018-07-12 23:21:09 +02:00
Build withPassphrase(Passphrase passphrase);
2018-06-02 21:21:35 +02:00
Build withoutPassphrase();
}
interface Build {
PGPKeyRing build() throws NoSuchAlgorithmException, PGPException, NoSuchProviderException,
InvalidAlgorithmParameterException;
2018-06-02 21:21:35 +02:00
}
}