Skip to content

Conversation

@theacodes
Copy link
Contributor

No description provided.

@theacodes theacodes added this to the 1.0.0 milestone Oct 4, 2016
@@ -0,0 +1,65 @@
# Copyright 2015 Google Inc.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

for start in six.moves.xrange(0, num_bits, 8):
curr_bits = bit_list[start:start + 8]
char_val = sum(val * digit
for val, digit in zip(_POW2, curr_bits))

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

message = _helpers.to_bytes(message, encoding='utf-8')
try:
return rsa.pkcs1.verify(message, signature, self._pubkey)
except (ValueError, rsa.pkcs1.VerificationError):

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

ValueError: If the public_key can't be parsed.
"""
public_key = _helpers.to_bytes(public_key)
is_x509_cert = b'-----BEGIN CERTIFICATE-----' in public_key

This comment was marked as spam.

This comment was marked as spam.

Returns:
bool: True if the signature is valid, otherwise False.
"""
if isinstance(certs, six.binary_type):

This comment was marked as spam.

This comment was marked as spam.



def test_to_bytes_with_nonstring_type():
with pytest.raises(ValueError):

This comment was marked as spam.

from google.auth import crypt


DATA_DIR = os.path.join(os.path.dirname(__file__), 'data')

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.


# List of certs
assert crypt.verify_signature(
to_sign, signature, [OTHER_CERT_BYTES, PUBLIC_CERT_BYTES]) is True

This comment was marked as spam.

This comment was marked as spam.

to_sign, signature, OTHER_CERT_BYTES) is False


class TestVerifier:

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

sphinx
commands = sphinx-apidoc --output-dir docs/reference --separate --module-first google
commands =
rm -r docs/reference

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.


# To generate privatekey.pem, privatekey.pub, and public_cert.pem:
# $ openssl req -new -newkey rsa:1024 -x509 -nodes -out public_cert.pem \
# -keyout privatekey.pem

This comment was marked as spam.

This comment was marked as spam.

@dhermes
Copy link
Contributor

dhermes commented Oct 4, 2016

Really great that you added the commands to generate the key files!

@theacodes
Copy link
Contributor Author

@dhermes any outstanding comments?

@dhermes
Copy link
Contributor

dhermes commented Oct 4, 2016

LGTM

@theacodes
Copy link
Contributor Author

The first module is in!

carly

@theacodes theacodes merged commit 8713a71 into master Oct 4, 2016
@theacodes theacodes deleted the crypt branch October 4, 2016 21:19
@theacodes theacodes mentioned this pull request Oct 21, 2016
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants