Beispiel #1
0
 def to_der(self):
     order = self.pubkey.order
     x_str = number_to_string(self.pubkey.point.x(), order)
     y_str = number_to_string(self.pubkey.point.y(), order)
     point_str = "\x00\x04" + x_str + y_str
     return der.encode_sequence(der.encode_sequence(encoded_oid_ecPublicKey,
                                                    self.curve.encoded_oid),
                                der.encode_bitstring(point_str))
Beispiel #2
0
 def to_der(self):
     order = self.pubkey.order
     x_str = number_to_string(self.pubkey.point.x(), order)
     y_str = number_to_string(self.pubkey.point.y(), order)
     point_str = "\x00\x04" + x_str + y_str
     return der.encode_sequence(der.encode_sequence(encoded_oid_ecPublicKey,
                                                    self.curve.encoded_oid),
                                der.encode_bitstring(point_str))
Beispiel #3
0
 def to_der(self):
     # SEQ([int(1), octetstring(privkey),cont[0], oid(secp224r1),
     #      cont[1],bitstring])
     encoded_vk = "\x00\x04" + self.get_verifying_key().to_string()
     return der.encode_sequence(der.encode_integer(1),
                                der.encode_octet_string(self.to_string()),
                                der.encode_constructed(0, self.curve.encoded_oid),
                                der.encode_constructed(1, der.encode_bitstring(encoded_vk)),
                                )
Beispiel #4
0
 def to_der(self):
     # SEQ([int(1), octetstring(privkey),cont[0], oid(secp224r1),
     #      cont[1],bitstring])
     encoded_vk = "\x00\x04" + self.get_verifying_key().to_string()
     return der.encode_sequence(der.encode_integer(1),
                                der.encode_octet_string(self.to_string()),
                                der.encode_constructed(0, self.curve.encoded_oid),
                                der.encode_constructed(1, der.encode_bitstring(encoded_vk)),
                                )
Beispiel #5
0
 def test_sequence(self):
     x = der.encode_sequence(b("ABC"), b("DEF")) + b("GHI")
     self.assertEqual(x, b("\x30\x06ABCDEFGHI"))
     x1, rest = der.remove_sequence(x)
     self.assertEqual(x1, b("ABCDEF"))
     self.assertEqual(rest, b("GHI"))
 def test_sequence(self):
     x = der.encode_sequence("ABC", "DEF") + "GHI"
     self.failUnlessEqual(x, "\x30\x06ABCDEFGHI")
     x1, rest = der.remove_sequence(x)
     self.failUnlessEqual(x1, "ABCDEF")
     self.failUnlessEqual(rest, "GHI")
 def test_sequence(self):
     x = der.encode_sequence("ABC", "DEF") + "GHI"
     self.failUnlessEqual(x, "\x30\x06ABCDEFGHI")
     x1, rest = der.remove_sequence(x)
     self.failUnlessEqual(x1, "ABCDEF")
     self.failUnlessEqual(rest, "GHI")
Beispiel #8
0
def sigencode_der(r, s, order):
    return der.encode_sequence(der.encode_integer(r), der.encode_integer(s))
Beispiel #9
0
def sigencode_der(r, s, order):
    return der.encode_sequence(der.encode_integer(r), der.encode_integer(s))