Brian Muramatsu | c3d2f1d | 2011-07-08 15:39:16 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # Copyright (C) 2011 The Android Open Source Project |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | |
| 17 | if [[ -z $ANDROID_BUILD_TOP ]]; then |
| 18 | echo "Run 'lunch' to set \$ANDROID_BUILD_TOP" >&2 |
| 19 | exit 1 |
| 20 | fi |
| 21 | |
| 22 | # Output the Java file with the certificate fingerprints |
| 23 | cat <<-STARTCLASS |
| 24 | /* |
| 25 | * Copyright (C) 2011 The Android Open Source Project |
| 26 | * |
| 27 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 28 | * you may not use this file except in compliance with the License. |
| 29 | * You may obtain a copy of the License at |
| 30 | * |
| 31 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 32 | * |
| 33 | * Unless required by applicable law or agreed to in writing, software |
| 34 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 35 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
| 36 | * implied. |
| 37 | * See the License for the specific language governing permissions |
| 38 | * and |
| 39 | * limitations under the License. |
| 40 | */ |
| 41 | |
| 42 | package android.security.cts; |
Adam Vartanian | 096a66f | 2017-07-13 14:17:25 +0100 | [diff] [blame] | 43 | import android.platform.test.annotations.SecurityTest; |
Brian Muramatsu | c3d2f1d | 2011-07-08 15:39:16 -0700 | [diff] [blame] | 44 | |
| 45 | /** |
| 46 | * Run "./cts/tools/utils/java-cert-list-generator.sh > |
| 47 | * cts/tests/tests/security/src/android/security/cts/CertificateData.java" |
| 48 | * to generate this file. |
| 49 | */ |
Adam Vartanian | 096a66f | 2017-07-13 14:17:25 +0100 | [diff] [blame] | 50 | @SecurityTest |
Brian Muramatsu | c3d2f1d | 2011-07-08 15:39:16 -0700 | [diff] [blame] | 51 | class CertificateData { |
| 52 | static final String[] CERTIFICATE_DATA = { |
| 53 | STARTCLASS |
| 54 | |
Chad Brubaker | 950ef04 | 2015-12-10 12:48:04 -0800 | [diff] [blame] | 55 | CERT_DIRECTORY=$ANDROID_BUILD_TOP/system/ca-certificates/files/ |
Brian Muramatsu | c3d2f1d | 2011-07-08 15:39:16 -0700 | [diff] [blame] | 56 | for FILE in `ls $CERT_DIRECTORY`; do |
| 57 | FINGERPRINT=`cat $CERT_DIRECTORY/$FILE | grep "SHA1 Fingerprint=" | cut -d '=' -f 2` |
| 58 | echo " \"${FINGERPRINT}\"," |
| 59 | done |
| 60 | |
| 61 | cat <<-ENDCLASS |
| 62 | }; |
| 63 | } |
| 64 | ENDCLASS |