'>IB', data[offset: offset + length])
offset += length
self['public-key-algorithm'] = self._public_key_algorithms[algorithm]
- self['key'] = data[offset:]
+ if self['public-key-algorithm'].startswith('rsa '):
+ o, self['public-modulus'] = self._parse_multiprecision_integer(
+ data[offset:])
+ offset += o
+ o, self['public-exponent'] = self._parse_multiprecision_integer(
+ data[offset:])
+ offset += o
+ elif self['public-key-algorithm'].startswith('dsa '):
+ o, self['prime'] = self._parse_multiprecision_integer(
+ data[offset:])
+ offset += o
+ o, self['group-order'] = self._parse_multiprecision_integer(
+ data[offset:])
+ offset += o
+ o, self['group-generator'] = self._parse_multiprecision_integer(
+ data[offset:])
+ offset += o
+ o, self['public-key'] = self._parse_multiprecision_integer(
+ data[offset:])
+ offset += o
+ elif self['public-key-algorithm'].startswith('elgamal '):
+ o, self['prime'] = self._parse_multiprecision_integer(
+ data[offset:])
+ offset += o
+ o, self['group-generator'] = self._parse_multiprecision_integer(
+ data[offset:])
+ offset += o
+ o, self['public-key'] = self._parse_multiprecision_integer(
+ data[offset:])
+ offset += o
+ else:
+ raise NotImplementedError(
+ 'algorithm-specific key fields for {}'.format(
+ self['public-key-algorithm']))
+ return offset
def to_bytes(self):
pass