# Path: mom/_compat.py
#   INT_MAX = sys.maxsize
#   INT_MAX = sys.maxint
# INT64_MAX = (1 << 63) - 1
# INT32_MAX = (1 << 31) - 1
# INT16_MAX = (1 << 15) - 1
# UINT128_MAX = (1 << 128) - 1    # 340282366920938463463374607431768211455L
# UINT64_MAX = 0xffffffffffffffff  # ((1 << 64) - 1)
# UINT32_MAX = 0xffffffff  # ((1 << 32) - 1)
# UINT16_MAX = 0xffff  # ((1 << 16) - 1)
# UINT8_MAX = 0xff
#   MACHINE_WORD_SIZE = 64
#   UINT_MAX = UINT64_MAX
#   MACHINE_WORD_SIZE = 32
#   UINT_MAX = UINT32_MAX
#   MACHINE_WORD_SIZE = 64
#   UINT_MAX = UINT64_MAX
#   LONG_TYPE = long
#   LONG_TYPE = int
#   INT_TYPE = long
#   INTEGER_TYPES = (int, long)
#   INT_TYPE = int
#   INTEGER_TYPES = (int,)
#   BYTES_TYPE = bytes
#   BYTES_TYPE = str
#   UNICODE_TYPE = unicode
#   BASESTRING_TYPE = basestring
#   HAVE_PYTHON3 = False
#   UNICODE_TYPE = str
#   BASESTRING_TYPE = (str, bytes)
#   HAVE_PYTHON3 = True
# ZERO_BYTE = byte_literal("\x00")
# EMPTY_BYTE = byte_literal("")
# EQUAL_BYTE = byte_literal("=")
# PLUS_BYTE = byte_literal("+")
# HYPHEN_BYTE = byte_literal("-")
# FORWARD_SLASH_BYTE = byte_literal("/")
# UNDERSCORE_BYTE = byte_literal("_")
# DIGIT_ZERO_BYTE = byte_literal("0")
# HAVE_LITTLE_ENDIAN = bool(struct.pack("h", 1) == "\x01\x00")
#   def byte_ord(byte_):
#   def byte_ord(byte_):
#   def byte_literal(literal):
#   def byte_literal(literal):
#   def dict_each(func, iterable):
#   def dict_each(func, iterable):
#   def next(iterator, default=throw):
#   def generate_random_bytes(count):
#     def generate_random_bytes(count):
#       def generate_random_bytes(count):
#       def generate_random_bytes(_):
# def get_word_alignment(num, force_arch=64,
#                        _machine_word_size=MACHINE_WORD_SIZE):
#   class Throw(object):


from mom import _compat
  from mom.security import codec
  from mom.tests import test_mom_security_codec_pem
  from pyasn1.error import SubstrateUnderrunError
  import unittest2
o6YHLiTMTcBBSEg/K7lnLfcJbJZ/si2tTJ/aEZXemFCxOhA9InNDigh1kSPG7Hay
fnRean9LviaVqi4tQbx/iWGq8glrW493RY3qsO8rBfos8H2EzEivOaRySrDgQrrV
px44E0Pi3+ebE8vHTKi6IPrYt+IJMRpmSbBqXgxQbiNWLUSbTause1lfk/5nLk/W
DomqFwRLb+/FQzRpW2S3XJ3ThTuls8U5i9PcQQcW+vjIPmpgTxsW9JuEvjjCpCl0
cTfUdnrMUw7Q/Jxa1VCpn7RzeHlTLrSXkdq3xVB9gq6DG+umJRfsKPLmw9t5TbD1
CIfb09GR/D1+6ogCfayqZoXe/xaRRjM3nzOLP4Z4ouMyZC7krj/UsItg0Y8FS0Wq
gZU88x/X78LlryEvfB0KH/GuULo6ziAzsSsB5Okfm68lFLdaNWA2d3f8lPvQNmL3
bZI="""

  JUNK_PRIVATE_KEY = """\
    -----BEGIN PRIVATE KEY-----
    %s
    -----END PRIVATE KEY-----""" % JUNK
  JUNK_PUBLIC_KEY = """\
    -----BEGIN PUBLIC KEY-----
    %s
    -----END PUBLIC KEY-----""" % JUNK
  JUNK_CERTIFICATE = """\
    -----BEGIN CERTIFICATE-----
    %s
    -----END CERTIFICATE-----""" % JUNK


  class Test_public_key_pem_decode(unittest2.TestCase):
    def test_decode(self):
      self.assertDictEqual(codec.public_key_pem_decode(PUBLIC_KEY),
                           PUBLIC_KEY_DECODED)
      self.assertDictEqual(codec.public_key_pem_decode(CERTIFICATE),
                           PUBLIC_KEY_DECODED)


# Path: mom/_compat.py
#   INT_MAX = sys.maxsize
#   INT_MAX = sys.maxint
# INT64_MAX = (1 << 63) - 1
# INT32_MAX = (1 << 31) - 1
# INT16_MAX = (1 << 15) - 1
# UINT128_MAX = (1 << 128) - 1    # 340282366920938463463374607431768211455L
# UINT64_MAX = 0xffffffffffffffff  # ((1 << 64) - 1)
# UINT32_MAX = 0xffffffff  # ((1 << 32) - 1)
# UINT16_MAX = 0xffff  # ((1 << 16) - 1)
# UINT8_MAX = 0xff
#   MACHINE_WORD_SIZE = 64
#   UINT_MAX = UINT64_MAX
#   MACHINE_WORD_SIZE = 32
#   UINT_MAX = UINT32_MAX
#   MACHINE_WORD_SIZE = 64
#   UINT_MAX = UINT64_MAX
#   LONG_TYPE = long
#   LONG_TYPE = int
#   INT_TYPE = long
#   INTEGER_TYPES = (int, long)
#   INT_TYPE = int
#   INTEGER_TYPES = (int,)
#   BYTES_TYPE = bytes
#   BYTES_TYPE = str
#   UNICODE_TYPE = unicode
#   BASESTRING_TYPE = basestring
#   HAVE_PYTHON3 = False
#   UNICODE_TYPE = str
#   BASESTRING_TYPE = (str, bytes)
#   HAVE_PYTHON3 = True
# ZERO_BYTE = byte_literal("\x00")
# EMPTY_BYTE = byte_literal("")
# EQUAL_BYTE = byte_literal("=")
# PLUS_BYTE = byte_literal("+")
# HYPHEN_BYTE = byte_literal("-")
# FORWARD_SLASH_BYTE = byte_literal("/")
# UNDERSCORE_BYTE = byte_literal("_")
# DIGIT_ZERO_BYTE = byte_literal("0")
# HAVE_LITTLE_ENDIAN = bool(struct.pack("h", 1) == "\x01\x00")
#   def byte_ord(byte_):
#   def byte_ord(byte_):
#   def byte_literal(literal):
#   def byte_literal(literal):
#   def dict_each(func, iterable):
#   def dict_each(func, iterable):
#   def next(iterator, default=throw):
#   def generate_random_bytes(count):
#     def generate_random_bytes(count):
#       def generate_random_bytes(count):
#       def generate_random_bytes(_):
# def get_word_alignment(num, force_arch=64,
#                        _machine_word_size=MACHINE_WORD_SIZE):
#   class Throw(object):


# Path: mom/tests/test_mom_security_codec.py
from mom import _compat
  from mom.security import codec
  from mom.tests import test_mom_security_codec_pem
  from pyasn1.error import SubstrateUnderrunError
  import unittest2

o6YHLiTMTcBBSEg/K7lnLfcJbJZ/si2tTJ/aEZXemFCxOhA9InNDigh1kSPG7Hay
fnRean9LviaVqi4tQbx/iWGq8glrW493RY3qsO8rBfos8H2EzEivOaRySrDgQrrV
px44E0Pi3+ebE8vHTKi6IPrYt+IJMRpmSbBqXgxQbiNWLUSbTause1lfk/5nLk/W
DomqFwRLb+/FQzRpW2S3XJ3ThTuls8U5i9PcQQcW+vjIPmpgTxsW9JuEvjjCpCl0
cTfUdnrMUw7Q/Jxa1VCpn7RzeHlTLrSXkdq3xVB9gq6DG+umJRfsKPLmw9t5TbD1
CIfb09GR/D1+6ogCfayqZoXe/xaRRjM3nzOLP4Z4ouMyZC7krj/UsItg0Y8FS0Wq
gZU88x/X78LlryEvfB0KH/GuULo6ziAzsSsB5Okfm68lFLdaNWA2d3f8lPvQNmL3
bZI="""

  JUNK_PRIVATE_KEY = """\
    -----BEGIN PRIVATE KEY-----
    %s
    -----END PRIVATE KEY-----""" % JUNK
  JUNK_PUBLIC_KEY = """\
    -----BEGIN PUBLIC KEY-----
    %s
    -----END PUBLIC KEY-----""" % JUNK
  JUNK_CERTIFICATE = """\
    -----BEGIN CERTIFICATE-----
    %s
    -----END CERTIFICATE-----""" % JUNK


  class Test_public_key_pem_decode(unittest2.TestCase):
    def test_decode(self):
      self.assertDictEqual(codec.public_key_pem_decode(PUBLIC_KEY),
                           PUBLIC_KEY_DECODED)
      self.assertDictEqual(codec.public_key_pem_decode(CERTIFICATE),
                           PUBLIC_KEY_DECODED)


    def test_NotImplementedError_when_not_public_key(self):