Skip to content

Commit f0cfff9

Browse files
RajeshGovosqrrrlanuraggoogler
authored
Gmail - smime certificate (googleworkspace#268)
* Updated arguments Co-authored-by: Steve Bazyl <sqrrrl@gmail.com> Co-authored-by: anuraggoogler <aanursharm@google.com>
1 parent 797d879 commit f0cfff9

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

‎gmail/snippet/smime snippets/create_smime_info.py‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,16 @@
1616
import base64
1717

1818

19-
def create_smime_info():
19+
def create_smime_info(cert_filename, cert_password):
2020
"""Create an smimeInfo resource for a certificate from file.
21+
Args:
22+
cert_filename: Name of the file containing the S/MIME certificate.
23+
cert_password: Password for the certificate file, or None if the file is not
24+
password-protected.
2125
Returns : Smime object, including smime information
2226
"""
2327

2428
smime_info = None
25-
cert_password = None
26-
cert_filename = 'humble_coder.csr'
2729
try:
2830
with open(cert_filename, 'rb') as cert:
2931
smime_info = {}
@@ -40,5 +42,5 @@ def create_smime_info():
4042

4143

4244
if __name__ == '__main__':
43-
print(create_smime_info())
45+
print(create_smime_info(cert_filename='xyz', cert_password='xyz'))
4446
# [END gmail_create_smime_info]

‎gmail/snippet/smime snippets/insert_smime_info.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def insert_smime_info():
3535
service = build('gmail', 'v1', credentials=creds)
3636

3737
user_id = 'gduser1@workspacesamples.dev'
38-
smime_info = create_smime_info.create_smime_info()
38+
smime_info = create_smime_info.create_smime_info(cert_filename='xyz', cert_password='xyz')
3939
send_as_email = None
4040

4141
if not send_as_email:

0 commit comments

Comments
 (0)