• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 libcore.util.NonNull;
20 import libcore.util.Nullable;
21 
22 import java.security.InvalidParameterException;
23 import java.util.Collections;
24 import java.util.HashMap;
25 import java.util.Map;
26 
27 /**
28  * An class representing a PAKE (Password Authenticated Key Exchange)
29  * option for TLS connections.
30  *
31  * <p>Instances of this class are immutable. Use the {@link Builder} to create
32  * instances.</p>
33  *
34  * @hide
35  */
36 public final class PakeOption {
37     /**
38      * Returns the algorithm of the PAKE algorithm.
39      *
40      * @return The algorithm of the PAKE algorithm.
41      */
getAlgorithm()42     public @NonNull String getAlgorithm() {
43         throw new RuntimeException("Stub!");
44     }
45 
46     /**
47      * Returns the message component with the given key.
48      *
49      * @param key The algorithm of the component.
50      * @return The component data, or {@code null} if no component with the given
51      *         key exists.
52      */
getMessageComponent(@onNull String key)53     public @Nullable byte[] getMessageComponent(@NonNull String key) {
54         throw new RuntimeException("Stub!");
55     }
56 
57     /**
58      * A builder for creating {@link PakeOption} instances.
59      *
60      * @hide
61      */
62     public static final class Builder {
63         /**
64          * Constructor for the builder.
65          *
66          * @param algorithm The algorithm of the PAKE algorithm.
67          * @throws InvalidParameterException If the algorithm is invalid.
68          */
Builder(@onNull String algorithm)69         public Builder(@NonNull String algorithm) {
70             throw new RuntimeException("Stub!");
71         }
72 
73         /**
74          * Adds a message component.
75          *
76          * @param key The algorithm of the component.
77          * @param value The component data.
78          * @return This builder.
79          * @throws InvalidParameterException If the key is invalid.
80          */
addMessageComponent(@onNull String key, @Nullable byte[] value)81         public @NonNull Builder addMessageComponent(@NonNull String key, @Nullable byte[] value) {
82             throw new RuntimeException("Stub!");
83         }
84 
85         /**
86          * Builds a new {@link PakeOption} instance.
87          *
88          * <p>This method performs validation to ensure that the message components
89          * are consistent with the PAKE algorithm.</p>
90          *
91          * @return A new {@link PakeOption} instance.
92          * @throws InvalidParameterException If the message components are invalid.
93          */
build()94         public @NonNull PakeOption build() {
95             throw new RuntimeException("Stub!");
96         }
97     }
98 }
99