summaryrefslogtreecommitdiffstats
path: root/wifi/keystore/1.0/IKeystore.hal
blob: 982b3464d74964d21c4fdaeb61f24bc8521f831f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
 * Copyright 2017 The Android Open Source Project
 *
 * 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 android.system.wifi.keystore@1.0;

/**
 * This is the root of the HAL module and is the interface returned when
 * loading an implementation of the Wi-Fi HAL. There must be at most one
 * module loaded in the system.
 */
interface IKeystore {
  /**
   * Return values for Keystore requests.
   */
  enum KeystoreStatusCode : uint32_t {
    /** No errors. */
    SUCCESS,
    ERROR_UNKNOWN
  };

  /**
   * Requests a binary blob from the keystore's key-value store.
   *
   * @param key the key into the keystore.
   * @return status KeystoreStatusCode of the operation.
   *         Possible status codes:
   *         |KeystoreStatusCode.SUCCESS|,
   *         |KeystoreStatusCode.ERROR_UNKNOWN|
   * @return value the value associated with |key| in the keystore.
   */
  getBlob(string key)
      generates (KeystoreStatusCode status, vec<uint8_t> value);

  /**
   * Requests the public key associated with the credential referred to by
   * |keyId|.
   *
   * @param keyId the key identifier associated with the credential.
   * @return status KeystoreStatusCode of the operation.
   *         Possible status codes:
   *         |KeystoreStatusCode.SUCCESS|,
   *         |KeystoreStatusCode.ERROR_UNKNOWN|
   * @return publicKey the public key associated with the credential.
   */
  getPublicKey(string keyId)
      generates (KeystoreStatusCode status, vec<uint8_t> publicKey);

  /**
   * Signs the digest in |dataToSign| with the private key associated with
   * the credential identified by |keyId|.  This is a raw RSA or ECDSA
   * operation that assumes |dataToSign| is already propertly digested and
   * padded if necessary for the type of key.
   *
   * @param keyId the key identifier associated with the credential.
   * @return status KeystoreStatusCode of the operation.
   *         Possible status codes:
   *         |KeystoreStatusCode.SUCCESS|,
   *         |KeystoreStatusCode.UNKNOWN|
   * @return signedData the signed data.
   */
  sign(string keyId, vec<uint8_t> dataToSign)
      generates (KeystoreStatusCode status, vec<uint8_t> signedData);
};