1 /* 2 * Copyright (C) 2024 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.net.ssl; 18 19 import static java.util.Objects.requireNonNull; 20 21 import libcore.util.NonNull; 22 import libcore.util.Nullable; 23 24 import java.security.InvalidParameterException; 25 import java.util.ArrayList; 26 import java.util.Collections; 27 import java.util.List; 28 29 import javax.net.ssl.ManagerFactoryParameters; 30 31 /** 32 * Parameters for configuring a {@code KeyManager} that supports PAKE (Password 33 * Authenticated Key Exchange). 34 * 35 * <p>This class holds the necessary information for the {@code KeyManager} to perform PAKE 36 * authentication, including the IDs of the client and server involved and the available PAKE 37 * options.</p> 38 * 39 * <p>Instances of this class are immutable. Use the {@link Builder} to create 40 * instances.</p> 41 * 42 * @hide 43 */ 44 public final class PakeClientKeyManagerParameters implements ManagerFactoryParameters { 45 /** 46 * Returns the client identifier. 47 * 48 * @return The client identifier. 49 */ getClientId()50 public @Nullable byte[] getClientId() { 51 throw new RuntimeException("Stub!"); 52 } 53 54 /** 55 * Returns the server identifier. 56 * 57 * @return The server identifier. 58 */ getServerId()59 public @Nullable byte[] getServerId() { 60 throw new RuntimeException("Stub!"); 61 } 62 63 /** 64 * Returns a copy of the list of available PAKE options. 65 * 66 * @return A copy of the list of available PAKE options. 67 */ getOptions()68 public @NonNull List<PakeOption> getOptions() { 69 throw new RuntimeException("Stub!"); 70 } 71 72 /** 73 * A builder for creating {@link PakeClientKeyManagerParameters} instances. 74 * 75 * @hide 76 */ 77 public static final class Builder { 78 /** 79 * Sets the ID of the client involved in the PAKE exchange. 80 * 81 * @param clientId The ID of the client involved in the PAKE exchange. 82 * @return This builder. 83 */ setClientId(@ullable byte[] clientId)84 public @NonNull Builder setClientId(@Nullable byte[] clientId) { 85 throw new RuntimeException("Stub!"); 86 } 87 88 /** 89 * Sets the ID of the server involved in the PAKE exchange. 90 * 91 * @param serverId The ID of the server involved in the PAKE exchange. 92 * @return This builder. 93 */ setServerId(@ullable byte[] serverId)94 public @NonNull Builder setServerId(@Nullable byte[] serverId) { 95 throw new RuntimeException("Stub!"); 96 } 97 98 /** 99 * Adds a PAKE option. 100 * 101 * @param option The PAKE option to add. 102 * @return This builder. 103 * @throws InvalidParameterException If an option with the same algorithm already exists. 104 */ addOption(@onNull PakeOption option)105 public @NonNull Builder addOption(@NonNull PakeOption option) { 106 throw new RuntimeException("Stub!"); 107 } 108 109 /** 110 * Builds a new {@link PakeClientKeyManagerParameters} instance. 111 * 112 * @return A new {@link PakeClientKeyManagerParameters} instance. 113 * @throws InvalidParameterException If no PAKE options are provided. 114 */ build()115 public @NonNull PakeClientKeyManagerParameters build() { 116 throw new RuntimeException("Stub!"); 117 } 118 } 119 } 120