def test_bad_certificate_name(self):
        interest1 = self._fixture.makeCommandInterest(self._fixture._identity)
        keyLocator = KeyLocator()
        keyLocator.setType(KeyLocatorType.KEYNAME)
        keyLocator.setKeyName(Name("/bad/cert/name"))
        signatureInfo = Sha256WithRsaSignature()
        signatureInfo.setKeyLocator(keyLocator)

        setNameComponent(
          interest1, CommandInterestSigner.POS_SIGNATURE_INFO,
          TlvWireFormat.get().encodeSignatureInfo(signatureInfo))
        self.validateExpectFailure(interest1, "Should fail (bad certificate name)")
    def test_bad_certificate_name(self):
        interest1 = self._fixture.makeCommandInterest(self._fixture._identity)
        keyLocator = KeyLocator()
        keyLocator.setType(KeyLocatorType.KEYNAME)
        keyLocator.setKeyName(Name("/bad/cert/name"))
        signatureInfo = Sha256WithRsaSignature()
        signatureInfo.setKeyLocator(keyLocator)

        setNameComponent(
            interest1, CommandInterestSigner.POS_SIGNATURE_INFO,
            TlvWireFormat.get().encodeSignatureInfo(signatureInfo))
        self.validateExpectFailure(interest1,
                                   "Should fail (bad certificate name)")
Exemplo n.º 3
0
    def generateFakeSignature():
        signatureInfo = Sha256WithRsaSignature()

        keyLocatorName = Name("/ndn/site1/KEY/ksk-2516425377094")
        keyLocator = KeyLocator()
        keyLocator.setType(KeyLocatorType.KEYNAME)
        keyLocator.setKeyName(keyLocatorName)
        signatureInfo.setKeyLocator(keyLocator)

        period = ValidityPeriod()
        period.setPeriod(fromIsoString("20141111T050000"),
                         fromIsoString("20141111T060000"))
        signatureInfo.setValidityPeriod(period)

        block2 = Blob(SIG_VALUE, False)
        signatureInfo.setSignature(block2)

        return signatureInfo