Example #1
0
        public SealService()
        {
            SealContext         = SealUtils.GetContext();
            using var keygen    = new KeyGenerator(SealContext);
            using var publicKey = keygen.PublicKey;
            using var secretKey = keygen.SecretKey;

            PublicKeyBase64  = SealUtils.PublicKeyToBase64String(publicKey);
            PrivateKeyBase64 = SealUtils.SecretKeyToBase64String(secretKey);
        }
Example #2
0
        public Decryptor CreateDecryptor()
        {
            Decryptor decryptor = new Decryptor(SealContext, SealUtils.BuildSecretKeyFromBase64String(PrivateKeyBase64, SealContext));

            return(decryptor);
        }
Example #3
0
        public Encryptor CreateEncryptor()
        {
            var encryptor = new Encryptor(SealContext, SealUtils.BuildPublicKeyFromBase64String(PublicKeyBase64, SealContext));

            return(encryptor);
        }