Beispiel #1
0
   def test_sign_verify(self):
      k = Keypair()
      k.create()

      data = "this is a test"
      sig = k.sign_string(data)

      print k.verify_string(data, sig)
Beispiel #2
0
    def test_sign_verify(self):
        k = Keypair()
        k.create()

        data = "this is a test"
        sig = k.sign_string(data)

        print k.verify_string(data, sig)
Beispiel #3
0
    def testSaveLoadFile(self):
        k = Keypair()
        k.create()

        k.save_to_file("test.key")

        k2 = Keypair()
        k2.load_from_file("test.key")

        self.assertEqual(k.as_pem(), k2.as_pem())
Beispiel #4
0
   def testSaveLoadFile(self):
      k = Keypair()
      k.create()

      k.save_to_file("test.key")

      k2 = Keypair()
      k2.load_from_file("test.key")

      self.assertEqual(k.as_pem(), k2.as_pem())
Beispiel #5
0
   def test_is_signed_by(self):
      cert1 = Certificate(subject="one")

      key1 = Keypair()
      key1.create()
      cert1.set_pubkey(key1)

      # create an issuer and sign the certificate
      issuerKey = Keypair(create=True)
      issuerSubject = "testissuer"
      cert1.set_issuer(issuerKey, issuerSubject)
      cert1.sign()

      cert2 = Certificate(subject="two")

      key2 = Keypair(create=True)
      cert2.set_pubkey(key2)

      cert2.set_issuer(key1, cert=cert1)

      # cert2 is signed by cert1
      self.assert_(cert2.is_signed_by_cert(cert1))
      # cert1 is not signed by cert2
      self.assert_(not cert1.is_signed_by_cert(cert2))
Beispiel #6
0
    def test_get_openssl_pkey(self):
        k = Keypair()
        k.create()

        pk = k.get_openssl_pkey()
        self.assert_(pk != None)
Beispiel #7
0
    def test_get_m2_pkey(self):
        k = Keypair()
        k.create()

        m2 = k.get_m2_pkey()
        self.assert_(m2 != None)
Beispiel #8
0
 def testCreate(self):
     k = Keypair()
     k.create()
Beispiel #9
0
   def test_get_openssl_pkey(self):
      k = Keypair()
      k.create()

      pk = k.get_openssl_pkey()
      self.assert_(pk != None)
Beispiel #10
0
   def test_get_m2_pkey(self):
      k = Keypair()
      k.create()

      m2 = k.get_m2_pkey()
      self.assert_(m2 != None)
Beispiel #11
0
 def testCreate(self):
    k = Keypair()
    k.create()