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 com.android.adservices.service.stats; 18 19 public interface SignatureVerificationLogger { 20 /** Records the start of a signature verification stage */ startSignatureVerification()21 void startSignatureVerification(); 22 23 /** Records the end of a signature verification stage */ endSignatureVerification()24 void endSignatureVerification(); 25 26 /** Records the start of a key fetch stage */ startKeyFetchForSignatureVerification()27 void startKeyFetchForSignatureVerification(); 28 29 /** Records the end of a key fetch stage */ endKeyFetchForSignatureVerification()30 void endKeyFetchForSignatureVerification(); 31 32 /** Records the start of a serialization stage */ startSerializationForSignatureVerification()33 void startSerializationForSignatureVerification(); 34 35 /** Records the end of a serialization stage */ endSerializationForSignatureVerification()36 void endSerializationForSignatureVerification(); 37 38 /** Records the number of keys fetched from key store */ setNumOfKeysFetched(int numOfKeysFetched)39 void setNumOfKeysFetched(int numOfKeysFetched); 40 41 /** Records the buyer enrollment id in case of a failed signature verification */ setFailedSignatureBuyerEnrollmentId(String enrollmentId)42 void setFailedSignatureBuyerEnrollmentId(String enrollmentId); 43 44 /** Records the seller enrollment id in case of a failed signature verification */ setFailedSignatureSellerEnrollmentId(String enrollmentId)45 void setFailedSignatureSellerEnrollmentId(String enrollmentId); 46 47 /** Records the caller package id enrollment id in case of a failed signature verification */ setFailedSignatureCallerPackageName(String callerPackageName)48 void setFailedSignatureCallerPackageName(String callerPackageName); 49 50 /** Records an unknown error caused failure for signature verification */ setFailureDetailUnknownError()51 void setFailureDetailUnknownError(); 52 53 /** Records a missing enrollment data caused failure for signature verification */ setFailureDetailNoEnrollmentDataForBuyer()54 void setFailureDetailNoEnrollmentDataForBuyer(); 55 56 /** Records no keys fetched for buyer caused failure for signature verification */ setFailureDetailNoKeysFetchedForBuyer()57 void setFailureDetailNoKeysFetchedForBuyer(); 58 59 /** Records buyer using wrong signature format caused failure for signature verification */ setFailureDetailWrongSignatureFormat()60 void setFailureDetailWrongSignatureFormat(); 61 62 /** Records number of keys with wrong key format */ addFailureDetailCountOfKeysWithWrongFormat()63 void addFailureDetailCountOfKeysWithWrongFormat(); 64 65 /** Records number of keys that failed to verify signature */ addFailureDetailCountOfKeysFailedToVerifySignature()66 void addFailureDetailCountOfKeysFailedToVerifySignature(); 67 68 /** 69 * This method should be called at the end of signing verification for each {@link 70 * android.adservices.adselection.SignedContextualAds} object. 71 */ close(int signingVerificationStatus)72 void close(int signingVerificationStatus); 73 } 74