• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2023 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 com.android.server.wifi;
18 
19 import android.annotation.NonNull;
20 
21 import java.security.cert.X509Certificate;
22 import java.util.Objects;
23 
24 /**
25  * Stores supplicant certificate event information
26  */
27 public class CertificateEventInfo {
CertificateEventInfo(@onNull X509Certificate cert, @NonNull String certHash)28     CertificateEventInfo(@NonNull X509Certificate cert, @NonNull String certHash) {
29         this.mCert = Objects.requireNonNull(cert);
30         this.mCertHash = Objects.requireNonNull(certHash);
31     }
32     @NonNull private final X509Certificate mCert;
33     @NonNull private final String mCertHash;
34 
35     /**
36      * Get the X509 certificate stored in this object
37      *
38      * @return X509 certificate
39      */
getCert()40     public X509Certificate getCert() {
41         return mCert;
42     }
43 
44     /**
45      * Get the certificate hash of the stored certificate
46      *
47      * @return certificate hash
48      */
getCertHash()49     public String getCertHash() {
50         return mCertHash;
51     }
52 
53     @Override
toString()54     public String toString() {
55         StringBuilder sb = new StringBuilder();
56         sb.append(" Certificate Hash: ").append(mCertHash);
57         sb.append(" X509Certificate: ").append(mCert);
58         return sb.toString();
59     }
60 }
61 
62 
63 
64