コード例 #1
0
ファイル: KeySetTest.cs プロジェクト: dwat001/keyczar-dotnet
        public void TestGetPrimary()
        {
            // based on the checked in files, we know version 2 is primary.
            var reader          = new KeySet(Util.TestDataPath(TEST_DATA, "rsa"));
            var knownPrimaryKey = reader.GetKey(2 /* primary key version */);
            var readerKey       = new GetPrimary(reader).GetPrimaryExposed();

            Expect(readerKey.GetKeyHash(), Is.EqualTo(knownPrimaryKey.GetKeyHash()));
        }
コード例 #2
0
ファイル: ToolTest.cs プロジェクト: dwat001/keyczar-dotnet
        public void TestAddPadding()
        {
            string result;

            var path  = Util.TestDataPath(TEST_DATA, "padding");
            var path2 = Util.TestDataPath(TEST_DATA, "padding.public");

            if (Directory.Exists(path))
            {
                Directory.Delete(path, true);
            }
            if (Directory.Exists(path2))
            {
                Directory.Delete(path2, true);
            }

            result = Util.KeyczarTool(create: null, location: path, purpose: "crypt", asymmetric: null);

            Expect(result, Is.StringContaining(KeyczarTool.Localized.MsgCreatedKeySet));

            result = Util.KeyczarTool(addkey: null, location: path, status: "primary", padding: "PKCS", size: "1024");

            Expect(result, Is.StringContaining(KeyczarTool.Localized.MsgCreatedKey));


            var     ks  = new KeySet(path);
            dynamic key = ks.GetKey(1);

            Expect((int)key.Size, Is.EqualTo(1024));
            Expect((string)key.Padding, Is.EqualTo("PKCS"));


            result = Util.KeyczarTool(pubkey: null, location: path, destination: path2);

            Expect(result, Is.StringContaining(KeyczarTool.Localized.MsgNewPublicKeySet));

            var     ks2  = new KeySet(path);
            dynamic key2 = ks2.GetKey(1);

            Expect(key2.Size, Is.EqualTo(1024));
            Expect(key2.Padding, Is.EqualTo("PKCS"));

            Directory.Delete(path2, true);
            Directory.Delete(path, true);
        }
コード例 #3
0
 public HDKeyData GetUnused(int lookahead)
 {
     return(KeySet.GetKey(State.NextUnused + lookahead));
 }