예제 #1
0
            public DecryptorFixture(Name identityName)
            {
                this.storage_ = new InMemoryStorageRetaining();
                /* foreach */
                // Include the code here from the NAC unit-tests class
                // DecryptorStaticDataEnvironment instead of making it a base class.
                foreach (ByteBuffer buffer  in  net.named_data.jndn.tests.integration_tests.EncryptStaticData.managerPackets)
                {
                    Data data = new Data();
                    data.wireDecode(buffer);
                    storage_.insert(data);
                }

                /* foreach */
                foreach (ByteBuffer buffer_0  in  net.named_data.jndn.tests.integration_tests.EncryptStaticData.encryptorPackets)
                {
                    Data data_1 = new Data();
                    data_1.wireDecode(buffer_0);
                    storage_.insert(data_1);
                }

                // Import the "/first/user" identity.
                keyChain_.importSafeBag(
                    new SafeBag(net.named_data.jndn.tests.integration_tests.EncryptStaticData.userIdentity), new Blob(
                        "password").buf());

                addIdentity(new Name("/not/authorized"));

                face_      = new InMemoryStorageFace(storage_);
                validator_ = new ValidatorNull();
                decryptor_ = new DecryptorV2(keyChain_.getPib()
                                             .getIdentity(identityName).getDefaultKey(), validator_,
                                             keyChain_, face_);
            }
예제 #2
0
            public EncryptorFixture(bool shouldPublishData, net.named_data.jndn.encrypt.EncryptError.OnError onError)
            {
                this.storage_ = new InMemoryStorageRetaining();
                // Include the code here from the NAC unit-tests class
                // EncryptorStaticDataEnvironment instead of making it a base class.
                if (shouldPublishData)
                {
                    publishData();
                }

                face_      = new InMemoryStorageFace(storage_);
                validator_ = new ValidatorNull();
                encryptor_ = new EncryptorV2(new Name(
                                                 "/access/policy/identity/NAC/dataset"), new Name(
                                                 "/some/ck/prefix"), new SigningInfo(
                                                 net.named_data.jndn.security.SigningInfo.SignerType.SHA256), onError, validator_,
                                             keyChain_, face_);
            }
예제 #3
0
            public AccessManagerFixture()
            {
                this.userIdentities_ = new ArrayList <PibIdentity>();
                face_           = new InMemoryStorageFace(new InMemoryStorageRetaining());
                accessIdentity_ = addIdentity(new Name("/access/policy/identity"));
                // This is a hack to get access to the KEK key-id.
                nacIdentity_ = addIdentity(new Name(
                                               "/access/policy/identity/NAC/dataset"), new RsaKeyParams());
                ILOG.J2CsMapping.Collections.Collections.Add(userIdentities_, addIdentity(new Name("/first/user"),
                                                                                          new RsaKeyParams()));
                ILOG.J2CsMapping.Collections.Collections.Add(userIdentities_, addIdentity(new Name("/second/user"),
                                                                                          new RsaKeyParams()));
                manager_ = new AccessManagerV2(accessIdentity_,
                                               new Name("/dataset"), keyChain_, face_);

                /* foreach */
                foreach (PibIdentity user  in  userIdentities_)
                {
                    manager_.addMember(user.getDefaultKey().getDefaultCertificate());
                }
            }