예제 #1
0
        public static string verifyText(string src, IPrivKey key)
        {
            int rc = Crypt_Verify(src, -1, null, null, key.getKey());

            if (rc != 0)
            {
                throw(new IPrivException(rc));
            }
            return("");
        }
예제 #2
0
        public static IPrivKey openPublicKey(string path, uint keyserial)
        {
            IPrivKey k  = new IPrivKey();
            int      rc = Crypt_OpenPublicKeyFromFile(0, path, keyserial, k.getKey(), null);

            if (rc != 0)
            {
                throw(new IPrivException(rc));
            }
            return(k);
        }
예제 #3
0
        public static IPrivKey openSecretKey(string path, string passwd)
        {
            IPrivKey k  = new IPrivKey();
            int      rc = Crypt_OpenSecretKeyFromFile(0, path, passwd, k.getKey());

            if (rc != 0)
            {
                throw(new IPrivException(rc));
            }
            return(k);
        }
예제 #4
0
        public static string signText(string src, IPrivKey key)
        {
            string        dst;
            StringBuilder tmp = new StringBuilder(2048);
            int           rc  = Crypt_Sign(src, src.Length, tmp, tmp.Capacity, key.getKey());

            if (rc < 0)
            {
                throw(new IPrivException(rc));
            }
            dst = tmp.ToString(0, rc);
            return(dst);
        }
예제 #5
0
 public static void closeKey(IPrivKey key)
 {
     Crypt_CloseKey(key.getKey());
 }