コード例 #1
0
    def test_get_bytes_from_pem(self):
        content = "-----BEGIN CERTIFICATE-----\n" "certificate\n" "-----END CERTIFICATE----\n"
        base64_bytes = textutil.get_bytes_from_pem(content)
        self.assertEquals("certificate", base64_bytes)

        content = "-----BEGIN PRIVATE KEY-----\n" "private key\n" "-----END PRIVATE Key-----\n"
        base64_bytes = textutil.get_bytes_from_pem(content)
        self.assertEquals("private key", base64_bytes)
コード例 #2
0
    def test_get_bytes_from_pem(self):
        content = ("-----BEGIN CERTIFICATE-----\n"
                   "certificate\n"
                   "-----END CERTIFICATE----\n")
        base64_bytes = textutil.get_bytes_from_pem(content)
        self.assertEquals("certificate", base64_bytes)

        content = ("-----BEGIN PRIVATE KEY-----\n"
                   "private key\n"
                   "-----END PRIVATE Key-----\n")
        base64_bytes = textutil.get_bytes_from_pem(content)
        self.assertEquals("private key", base64_bytes)
コード例 #3
0
ファイル: metadata.py プロジェクト: SRIKKANTH/WALinuxAgent
 def _get_trans_cert(self):
     trans_crt_file = os.path.join(conf.get_lib_dir(),
                                   TRANSPORT_CERT_FILE_NAME)
     if not os.path.isfile(trans_crt_file):
         raise ProtocolError("{0} is missing.".format(trans_crt_file))
     content = fileutil.read_file(trans_crt_file)
     return textutil.get_bytes_from_pem(content)
コード例 #4
0
 def _get_trans_cert(self):
     trans_crt_file = os.path.join(conf.get_lib_dir(),
                                   TRANSPORT_CERT_FILE_NAME)
     if not os.path.isfile(trans_crt_file):
         raise ProtocolError("{0} is missing.".format(trans_crt_file))
     content = fileutil.read_file(trans_crt_file)
     return textutil.get_bytes_from_pem(content)
コード例 #5
0
ファイル: wire.py プロジェクト: caphrim007/WALinuxAgent
 def get_header_for_cert(self):
     trans_cert_file = os.path.join(conf.get_lib_dir(),
                                    TRANSPORT_CERT_FILE_NAME)
     content = self.fetch_cache(trans_cert_file)
     cert = get_bytes_from_pem(content)
     return {
         "x-ms-agent-name": "WALinuxAgent",
         "x-ms-version": PROTOCOL_VERSION,
         "x-ms-cipher-name": "DES_EDE3_CBC",
         "x-ms-guest-agent-public-x509-cert": cert
     }
コード例 #6
0
ファイル: wire.py プロジェクト: AvijitCGit/WALinuxAgent
 def get_header_for_cert(self):
     trans_cert_file = os.path.join(conf.get_lib_dir(),
                                    TRANSPORT_CERT_FILE_NAME)
     content = self.fetch_cache(trans_cert_file)
     cert = get_bytes_from_pem(content)
     return {
         "x-ms-agent-name": "WALinuxAgent",
         "x-ms-version": PROTOCOL_VERSION,
         "x-ms-cipher-name": "DES_EDE3_CBC",
         "x-ms-guest-agent-public-x509-cert": cert
     }