001/* 002 * Copyright 2018 Paul Schaub. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.pgpainless.key.generation; 017 018import javax.annotation.Nonnull; 019 020import org.pgpainless.algorithm.CompressionAlgorithm; 021import org.pgpainless.algorithm.Feature; 022import org.pgpainless.algorithm.HashAlgorithm; 023import org.pgpainless.algorithm.KeyFlag; 024import org.pgpainless.algorithm.SymmetricKeyAlgorithm; 025 026public interface KeySpecBuilderInterface { 027 028 WithDetailedConfiguration withKeyFlags(@Nonnull KeyFlag... flags); 029 030 WithDetailedConfiguration withDefaultKeyFlags(); 031 032 KeySpec withInheritedSubPackets(); 033 034 interface WithDetailedConfiguration { 035 036 WithPreferredSymmetricAlgorithms withDetailedConfiguration(); 037 038 KeySpec withDefaultAlgorithms(); 039 } 040 041 interface WithPreferredSymmetricAlgorithms { 042 043 WithPreferredHashAlgorithms withPreferredSymmetricAlgorithms(@Nonnull SymmetricKeyAlgorithm... algorithms); 044 045 WithPreferredHashAlgorithms withDefaultSymmetricAlgorithms(); 046 047 WithFeatures withDefaultAlgorithms(); 048 049 } 050 051 interface WithPreferredHashAlgorithms { 052 053 WithPreferredCompressionAlgorithms withPreferredHashAlgorithms(@Nonnull HashAlgorithm... algorithms); 054 055 WithPreferredCompressionAlgorithms withDefaultHashAlgorithms(); 056 057 } 058 059 interface WithPreferredCompressionAlgorithms { 060 061 WithFeatures withPreferredCompressionAlgorithms(@Nonnull CompressionAlgorithm... algorithms); 062 063 WithFeatures withDefaultCompressionAlgorithms(); 064 065 } 066 067 interface WithFeatures { 068 069 WithFeatures withFeature(@Nonnull Feature feature); 070 071 KeySpec done(); 072 } 073 074}