binder: X509 are serialized to vector<uint8_t>

Change it from a string to a vector<uint8_t>. For DER
format, it is not a print-able string.

Test: pass
Bug: 198833574
Change-Id: I6b4d0ebc2d7429e927f7ca5abccc3f6aedfe1e6a
diff --git a/libs/binder/RpcServer.cpp b/libs/binder/RpcServer.cpp
index 7fa2f57..1d42fc3 100644
--- a/libs/binder/RpcServer.cpp
+++ b/libs/binder/RpcServer.cpp
@@ -141,7 +141,7 @@
     return ret;
 }
 
-std::string RpcServer::getCertificate(CertificateFormat format) {
+std::vector<uint8_t> RpcServer::getCertificate(CertificateFormat format) {
     std::lock_guard<std::mutex> _l(mLock);
     return mCtx->getCertificate(format);
 }
diff --git a/libs/binder/RpcSession.cpp b/libs/binder/RpcSession.cpp
index c5a8dd1..8449b3c 100644
--- a/libs/binder/RpcSession.cpp
+++ b/libs/binder/RpcSession.cpp
@@ -703,7 +703,7 @@
     return false;
 }
 
-std::string RpcSession::getCertificate(CertificateFormat format) {
+std::vector<uint8_t> RpcSession::getCertificate(CertificateFormat format) {
     return mCtx->getCertificate(format);
 }
 
diff --git a/libs/binder/RpcTransportRaw.cpp b/libs/binder/RpcTransportRaw.cpp
index 62c9530..827e518 100644
--- a/libs/binder/RpcTransportRaw.cpp
+++ b/libs/binder/RpcTransportRaw.cpp
@@ -111,7 +111,7 @@
     std::unique_ptr<RpcTransport> newTransport(android::base::unique_fd fd, FdTrigger*) const {
         return std::make_unique<RpcTransportRaw>(std::move(fd));
     }
-    std::string getCertificate(CertificateFormat) const override { return {}; }
+    std::vector<uint8_t> getCertificate(CertificateFormat) const override { return {}; }
 };
 
 } // namespace
diff --git a/libs/binder/RpcTransportTls.cpp b/libs/binder/RpcTransportTls.cpp
index 180b76e..c42ea9a 100644
--- a/libs/binder/RpcTransportTls.cpp
+++ b/libs/binder/RpcTransportTls.cpp
@@ -450,7 +450,7 @@
             std::shared_ptr<RpcCertificateVerifier> verifier);
     std::unique_ptr<RpcTransport> newTransport(android::base::unique_fd fd,
                                                FdTrigger* fdTrigger) const override;
-    std::string getCertificate(CertificateFormat) const override;
+    std::vector<uint8_t> getCertificate(CertificateFormat) const override;
 
 protected:
     static ssl_verify_result_t sslCustomVerify(SSL* ssl, uint8_t* outAlert);
@@ -459,7 +459,7 @@
     std::shared_ptr<RpcCertificateVerifier> mCertVerifier;
 };
 
-std::string RpcTransportCtxTls::getCertificate(CertificateFormat) const {
+std::vector<uint8_t> RpcTransportCtxTls::getCertificate(CertificateFormat) const {
     // TODO(b/195166979): return certificate here
     return {};
 }
diff --git a/libs/binder/include/binder/RpcServer.h b/libs/binder/include/binder/RpcServer.h
index 5229cfe..9f92410 100644
--- a/libs/binder/include/binder/RpcServer.h
+++ b/libs/binder/include/binder/RpcServer.h
@@ -135,7 +135,7 @@
     /**
      * See RpcTransportCtx::getCertificate
      */
-    std::string getCertificate(CertificateFormat);
+    std::vector<uint8_t> getCertificate(CertificateFormat);
 
     /**
      * Runs join() in a background thread. Immediately returns.
diff --git a/libs/binder/include/binder/RpcSession.h b/libs/binder/include/binder/RpcSession.h
index 91db637..76ef9ff 100644
--- a/libs/binder/include/binder/RpcSession.h
+++ b/libs/binder/include/binder/RpcSession.h
@@ -131,7 +131,7 @@
     /**
      * See RpcTransportCtx::getCertificate
      */
-    std::string getCertificate(CertificateFormat);
+    std::vector<uint8_t> getCertificate(CertificateFormat);
 
     /**
      * Shuts down the service.
diff --git a/libs/binder/include/binder/RpcTransport.h b/libs/binder/include/binder/RpcTransport.h
index da132a1..4ad7bf4 100644
--- a/libs/binder/include/binder/RpcTransport.h
+++ b/libs/binder/include/binder/RpcTransport.h
@@ -73,7 +73,7 @@
     // Implementation details:
     // - For raw sockets, this always returns empty string.
     // - For TLS, this returns the certificate. See RpcTransportTls for details.
-    [[nodiscard]] virtual std::string getCertificate(CertificateFormat format) const = 0;
+    [[nodiscard]] virtual std::vector<uint8_t> getCertificate(CertificateFormat format) const = 0;
 
 protected:
     RpcTransportCtx() = default;