Exemple #1
0
        /// <summary>
        /// Log Error
        /// </summary>
        /// <param name="onlyIfUnique">Only is is unique</param>
        public void Save(bool onlyIfUnique)
        {
            if (ReplicationData == null || ReplicationData.Length <= 0)
            {
                return;
            }

            var step = Error == EFuzzingErrorType.Crash ? "crashes" : "failures";
            var name = $"{step}/{DateTime.UtcNow.ToString("yyyy-MM-dd")}/uniques/{ErrorId.ToString()}.zip";

            if (!File.Exists(name))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(name));
                File.WriteAllBytes(name, ReplicationData);
            }

            if (onlyIfUnique)
            {
                return;
            }

            name = $"{step}/{DateTime.UtcNow.ToString("yyyy-MM-dd")}/{Guid.NewGuid().ToString()}.zip";
            Directory.CreateDirectory(Path.GetDirectoryName(name));
            File.WriteAllBytes(name, ReplicationData);
        }
 public static void ThrowsPart <TInner>(ErrorId id, RetryMode retry, Action action)
     where TInner : Exception
 {
     ThrowsPart(new CompositionErrorExpectation {
         Id = id, InnerExceptionType = typeof(TInner)
     }, retry, action);
 }
        /// <summary>
        /// Returns true if PaymentErrorResponse instances are equal
        /// </summary>
        /// <param name="other">Instance of PaymentErrorResponse to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(PaymentErrorResponse other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     ErrorId == other.ErrorId ||
                     ErrorId != null &&
                     ErrorId.Equals(other.ErrorId)
                     ) &&
                 (
                     Errors == other.Errors ||
                     Errors != null &&
                     Errors.SequenceEqual(other.Errors)
                 ) &&
                 (
                     PaymentResult == other.PaymentResult ||
                     PaymentResult != null &&
                     PaymentResult.Equals(other.PaymentResult)
                 ));
        }
Exemple #4
0
 public Error(string message, ErrorId id, RangeInfo range, string subject = null)
 {
     Message = message;
     Id      = id;
     Range   = range;
     Subject = subject;
 }
Exemple #5
0
        public byte[] Decrypt(IntPtr privateKey, byte[] ciphertext)
        {
            int dataSize = this.tempBuf.Length;
            this.errorId = LibpreWrapper.Decrypt(this.parameters, privateKey, this.tempBuf, ref dataSize, ciphertext, ciphertext.Length, this.scheme);
            AssertSuccess();

            return tempBuf.RangeSubset(0, dataSize);
        }
        public TaskResultResponse(dynamic json)
        {
            ErrorId = JsonHelper.ExtractInt(json, "errorId");

            if (ErrorId != null)
            {
                if (ErrorId.Equals(0))
                {
                    Status = ParseStatus(JsonHelper.ExtractStr(json, "status"));

                    if (Status.Equals(StatusType.Ready))
                    {
                        Cost       = JsonHelper.ExtractDouble(json, "cost");
                        Ip         = JsonHelper.ExtractStr(json, "ip", null, true);
                        SolveCount = JsonHelper.ExtractInt(json, "solveCount", null, true);
                        CreateTime = UnixTimeStampToDateTime(JsonHelper.ExtractDouble(json, "createTime"));
                        EndTime    = UnixTimeStampToDateTime(JsonHelper.ExtractDouble(json, "endTime"));

                        Solution = new SolutionData
                        {
                            Token = JsonHelper.ExtractStr(json, "solution", "token", true),
                            GRecaptchaResponse =
                                JsonHelper.ExtractStr(json, "solution", "gRecaptchaResponse", silent: true),
                            GRecaptchaResponseMd5 =
                                JsonHelper.ExtractStr(json, "solution", "gRecaptchaResponseMd5", silent: true),
                            Text = JsonHelper.ExtractStr(json, "solution", "text", silent: true),
                            Url  = JsonHelper.ExtractStr(json, "solution", "url", silent: true)
                        };

                        try
                        {
                            Solution.Answers = json.solution.answers;
                        }
                        catch
                        {
                            Solution.Answers = null;
                        }

                        if (Solution.GRecaptchaResponse == null && Solution.Text == null && Solution.Answers == null &&
                            Solution.Token == null)
                        {
                            DebugHelper.Out("Got no 'solution' field from API", DebugHelper.Type.Error);
                        }
                    }
                }
                else
                {
                    ErrorCode        = JsonHelper.ExtractStr(json, "errorCode");
                    ErrorDescription = JsonHelper.ExtractStr(json, "errorDescription") ?? "(no error description)";

                    DebugHelper.Out(ErrorDescription, DebugHelper.Type.Error);
                }
            }
            else
            {
                DebugHelper.Out("Unknown error", DebugHelper.Type.Error);
            }
        }
Exemple #7
0
        public static void ThrowsRootError(ErrorId rootId, RetryMode retry, Action action)
        {
            var exception = ExceptionAssert.Throws <CompositionException>(retry, action, (thrownException, retryCount) =>
            {
                ErrorId actualId = GetRootErrorId(thrownException);

                Assert.AreEqual(rootId, actualId, "Retry Count {0}: Expected '{1}' to be the root ErrorId, however, '{2}' is.", retryCount, rootId, actualId);
            });
        }
Exemple #8
0
        public IntPtr DeserializePrivateKey(byte[] buffer)
        {
            IntPtr privateKey;

            this.errorId = LibpreWrapper.DeserializePrivateKey(this.parameters, buffer, buffer.Length, out privateKey, this.scheme);
            AssertSuccess();

            return(privateKey);
        }
Exemple #9
0
        static Libpre()
        {
            ErrorId e = LibpreWrapper.InitLibrary(null, 0);

            if (e != ErrorId.None)
            {
                throw new InvalidOperationException("Initialization of LibPre failed");
            }
        }
Exemple #10
0
        public byte[] Encrypt(IntPtr publicKey, byte[] plaintext)
        {
            int cipherTextSize = this.tempBuf.Length;

            this.errorId = LibpreWrapper.Encrypt(this.parameters, publicKey, plaintext, plaintext.Length, this.tempBuf, ref cipherTextSize, CiphertextType.SecondLevel, this.scheme);
            AssertSuccess();

            return(tempBuf.RangeSubset(0, cipherTextSize));
        }
Exemple #11
0
        public IntPtr GenerateDelegationKey(IntPtr privateKeyForDelegator, IntPtr publicKeyForDelegatee)
        {
            IntPtr delegationKey;

            this.errorId = LibpreWrapper.GenerateDelegationKey(this.parameters, privateKeyForDelegator, publicKeyForDelegatee, out delegationKey, this.scheme);
            AssertSuccess();

            return(delegationKey);
        }
Exemple #12
0
        public IntPtr DeserializeDelegationKey(byte[] buffer)
        {
            IntPtr delegationKey;

            this.errorId = LibpreWrapper.DeserializeDelegationKey(buffer, buffer.Length, out delegationKey, this.scheme);
            AssertSuccess();

            return(delegationKey);
        }
Exemple #13
0
        public byte[] Reencrypt(IntPtr delegationKey, byte[] cipherText)
        {
            int newCipherTextSize = this.tempBuf.Length;

            this.errorId = LibpreWrapper.Reencrypt(this.parameters, delegationKey, cipherText, cipherText.Length, this.tempBuf, ref newCipherTextSize, this.scheme);
            AssertSuccess();

            return(tempBuf.RangeSubset(0, newCipherTextSize));
        }
Exemple #14
0
        public CompilationError(SourceRange sourceRange, ErrorId id, string text)
        {
            if (text == null)
                throw ExceptionBuilder.ArgumentNull("text");

            _sourceRange = sourceRange;
            _id = id;
            _text = text;
        }
Exemple #15
0
        private IntPtr DeserializeParams(byte[] buffer)
        {
            IntPtr par;

            this.errorId = LibpreWrapper.DeserializeParams(buffer, buffer.Length, out par, this.scheme);
            AssertSuccess();

            return(par);
        }
Exemple #16
0
        public byte[] Decrypt(IntPtr privateKey, byte[] ciphertext)
        {
            int dataSize = this.tempBuf.Length;

            this.errorId = LibpreWrapper.Decrypt(this.parameters, privateKey, this.tempBuf, ref dataSize, ciphertext, ciphertext.Length, this.scheme);
            AssertSuccess();

            return(tempBuf.RangeSubset(0, dataSize));
        }
Exemple #17
0
        public byte[] SerializePrivateKey(IntPtr privateKey)
        {
            int bytesWritten;

            this.errorId = LibpreWrapper.SerializePrivateKey(this.parameters, privateKey, this.tempBuf, out bytesWritten, this.tempBuf.Length, this.scheme);
            AssertSuccess();

            return(this.tempBuf.RangeSubset(0, bytesWritten));
        }
Exemple #18
0
        //private void DeleteParams(IntPtr par)
        //{
        //    this.errorId = LibpreWrapper.DestroyParams(par);
        //    AssertSuccess();
        //}

        public InMemoryKeyPair GenerateKeyPair()
        {
            IntPtr publicKey;
            IntPtr privateKey;

            this.errorId = LibpreWrapper.GenerateKeys(this.parameters, out publicKey, out privateKey, this.scheme);
            AssertSuccess();

            return(new InMemoryKeyPair(publicKey, privateKey));
        }
Exemple #19
0
        /// <summary>
        /// GetHashCode
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            var hashCode = -1592154030;

            hashCode = hashCode * -1521134295 + Error.GetHashCodeWithNullCheck();
            hashCode = hashCode * -1521134295 + ExplotationResult.GetHashCodeWithNullCheck();
            hashCode = hashCode * -1521134295 + ErrorId.GetHashCodeWithNullCheck();
            hashCode = hashCode * -1521134295 + ReplicationData.GetHashCodeWithNullCheck();
            return(hashCode);
        }
Exemple #20
0
        public CompilationError(SourceRange sourceRange, ErrorId id, string text)
        {
            if (text == null)
            {
                throw ExceptionBuilder.ArgumentNull("text");
            }

            _sourceRange = sourceRange;
            _id          = id;
            _text        = text;
        }
Exemple #21
0
        public static TestDefinition FromXml(XmlDocument xmlDocument)
        {
            TestDefinition result = new TestDefinition();

            result.CommandText = xmlDocument.SelectSingleNode("/test/sql").InnerText;

            XmlNode expectedRuntimeErrorNode = xmlDocument.SelectSingleNode("/test/expectedRuntimeError");

            if (expectedRuntimeErrorNode != null)
            {
                result.ExpectedRuntimeError = expectedRuntimeErrorNode.InnerText;
            }

            XmlNode expectedErrorsNode = xmlDocument.SelectSingleNode("/test/expectedErrors");

            if (expectedErrorsNode != null)
            {
                List <CompilationError> errorList = new List <CompilationError>();
                foreach (XmlNode expectedErrorNode in expectedErrorsNode.SelectNodes("expectedError"))
                {
                    ErrorId          errorId          = (ErrorId)Enum.Parse(typeof(ErrorId), expectedErrorNode.Attributes["id"].Value);
                    string           errorText        = expectedErrorNode.Attributes["text"].Value;
                    CompilationError compilationError = new CompilationError(SourceRange.Empty, errorId, errorText);
                    errorList.Add(compilationError);
                }

                result.ExpectedCompilationErrors = errorList.ToArray();
            }

            XmlNode expectedResultsNode = xmlDocument.SelectSingleNode("/test/expectedResults");

            if (expectedResultsNode != null)
            {
                using (StringReader stringReader = new StringReader(expectedResultsNode.InnerXml))
                {
                    DataSet dataSet = new DataSet();
                    dataSet.ReadXml(stringReader);
                    result.ExpectedResults = dataSet.Tables[0];
                }
            }

            XmlNode expectedPlanNode = xmlDocument.SelectSingleNode("/test/expectedPlan");

            if (expectedPlanNode != null)
            {
                result.ExpectedPlan = ShowPlan.FromXml(expectedPlanNode);
            }

            return(result);
        }
Exemple #22
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (ErrorId != 0)
            {
                hash ^= ErrorId.GetHashCode();
            }
            if (ErrorString.Length != 0)
            {
                hash ^= ErrorString.GetHashCode();
            }
            return(hash);
        }
        //TODO prepare some kind of my own errors with to log file mmethods - use Application_Error() method for that

        /// <summary>
        /// Some sort of try to catch all errors that wasnt cought
        /// </summary>
        /// <param name="e">Exception that was made and i hope it will work</param>
        protected void Application_Error()
        {
            Exception e = Server.GetLastError();
            string    PathToErrorFile = KneaderPrototype.Error.PathToErrorFile;
            DateTime  now             = DateTime.Now;

            ErrorId++;
            string timestamp = "\r\n" + now.ToString();

            if (PathToErrorFile != null)
            {
                System.IO.File.AppendAllText(PathToErrorFile, timestamp);
                System.IO.File.AppendAllText(PathToErrorFile, ErrorId.ToString());                                                             //set id  of Error
                System.IO.File.AppendAllText(PathToErrorFile, e.Message.ToString());
                System.IO.File.AppendAllText(PathToErrorFile, e.StackTrace.ToString());                                                        //Write Error to file
                Session["tempforview"] = timestamp + "    Error Id:" + ErrorId.ToString() + " occured so please try it again after some time"; //To screen also with id
            }
            else
            {
                if (Directory.Exists(Path.PhysicalPath + @"\ErroLog") == true &&
                    Directory.GetDirectories(Path.PhysicalPath, e.Source.ToString()) != null)
                {
                    PathToErrorFile = Path.PhysicalPath + @"\ErrorLog\" + e.Source.ToString() + @"\log.txt";
                    if (!System.IO.File.Exists(PathToErrorFile))
                    {
                        System.IO.File.Create(PathToErrorFile).Close(); //If log.txt does not exist create one
                    }
                    System.IO.File.AppendAllText(PathToErrorFile, timestamp);
                    System.IO.File.AppendAllText(PathToErrorFile, ErrorId.ToString());                                                             //set id  of Error
                    System.IO.File.AppendAllText(PathToErrorFile, e.Message.ToString());                                                           //Write Error to file
                    System.IO.File.AppendAllText(PathToErrorFile, e.StackTrace.ToString());                                                        //Write Error to file
                    Session["tempforview"] = timestamp + "    Error Id:" + ErrorId.ToString() + " occured so please try it again after some time"; //To screen also with id
                }
                else
                {
                    Directory.CreateDirectory(Path.PhysicalPath + @"\ErrorLog\" + e.Source.ToString());      //If directory in the path does not exist create one
                    PathToErrorFile = Path.PhysicalPath + @"\ErrorLog\" + e.Source.ToString() + @"\log.txt"; //Asign path to Path attribute
                    if (!System.IO.File.Exists(PathToErrorFile))
                    {
                        System.IO.File.Create(PathToErrorFile).Close(); //If log.txt does not exist create one
                    }
                    System.IO.File.AppendAllText(PathToErrorFile, timestamp);
                    System.IO.File.AppendAllText(PathToErrorFile, ErrorId.ToString());                                                             //set id  of Error
                    System.IO.File.AppendAllText(PathToErrorFile, e.Message.ToString());                                                           //Write Error to file
                    System.IO.File.AppendAllText(PathToErrorFile, e.StackTrace.ToString());                                                        //Write Error to file
                    Session["tempforview"] = timestamp + "    Error Id:" + ErrorId.ToString() + " occured so please try it again after some time"; //To screen also with id
                }
            }
            Server.ClearError();
        }
        public void ExpectedErrorOnSetImport(object importer, ErrorId expectedErrorId)
        {
            var container = ContainerFactory.Create();
            var batch     = new CompositionBatch();

            batch.AddPart(importer);
            batch.AddExportedValue("Value", 42);
            batch.AddExportedValue("Value", 0);

            CompositionAssert.ThrowsError(ErrorId.ImportEngine_PartCannotSetImport,
                                          expectedErrorId, RetryMode.DoNotRetry, () =>
            {
                container.Compose(batch);
            });
        }
Exemple #25
0
        public Libpre(Scheme scheme, byte[] parameters)
        {
            this.scheme = scheme;

            // Initialize unmanaged library by having it generate parameters first.
            // This is required to avoid a weird error where it otherwise would crash
            // the entire process if initialized with parameters the first time.
            this.errorId = LibpreWrapper.GenerateParams(out this.parameters, this.scheme);
            AssertSuccess();

            // if we actually received some premade parameters, then use those)
            if (parameters != null)
            {
                LibpreWrapper.DestroyParams(this.parameters);
                this.parameters = DeserializeParams(parameters);
            }
        }
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (ErrorId != null)
         {
             hashCode = hashCode * 59 + ErrorId.GetHashCode();
         }
         if (Errors != null)
         {
             hashCode = hashCode * 59 + Errors.GetHashCode();
         }
         return(hashCode);
     }
 }
Exemple #27
0
        public Libpre(Scheme scheme, byte[] parameters)
        {
            this.scheme = scheme;

            // Initialize unmanaged library by having it generate parameters first.
            // This is required to avoid a weird error where it otherwise would crash
            // the entire process if initialized with parameters the first time.
            this.errorId = LibpreWrapper.GenerateParams(out this.parameters, this.scheme);
            AssertSuccess();

            // if we actually received some premade parameters, then use those)
            if (parameters != null)
            {
                LibpreWrapper.DestroyParams(this.parameters);
                this.parameters = DeserializeParams(parameters);
            }
        }
Exemple #28
0
        public TaskResultResponse(dynamic json)
        {
            ErrorId = JsonHelper.ExtractInt(json, "errorId");

            if (ErrorId != null)
            {
                if (ErrorId.Equals(0))
                {
                    Status = ParseStatus(JsonHelper.ExtractStr(json, "status"));

                    if (Status.Equals(StatusType.Ready))
                    {
                        Cost       = JsonHelper.ExtractDouble(json, "cost");
                        Ip         = JsonHelper.ExtractStr(json, "ip");
                        SolveCount = JsonHelper.ExtractInt(json, "solveCount");
                        CreateTime = UnixTimeStampToDateTime(JsonHelper.ExtractDouble(json, "createTime"));
                        EndTime    = UnixTimeStampToDateTime(JsonHelper.ExtractDouble(json, "endTime"));

                        Solution = new SolutionData
                        {
                            GRecaptchaResponse =
                                JsonHelper.ExtractStr(json, "solution", "gRecaptchaResponse"),
                            GRecaptchaResponseMd5 =
                                JsonHelper.ExtractStr(json, "solution", "gRecaptchaResponseMd5"),
                            Text = JsonHelper.ExtractStr(json, "solution", "text"),
                            Url  = JsonHelper.ExtractStr(json, "solution", "url")
                        };

                        if (Solution.GRecaptchaResponse == null && Solution.Text == null)
                        {
                            throw new Exception("Got no 'solution' field from API");
                        }
                    }
                }
                else
                {
                    ErrorCode        = JsonHelper.ExtractStr(json, "errorCode");
                    ErrorDescription = JsonHelper.ExtractStr(json, "errorDescription") ?? "(no error description)";
                }
            }
            else
            {
                throw new Exception("Unknown error");
            }
        }
Exemple #29
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (ErrorId != 0)
            {
                hash ^= ErrorId.GetHashCode();
            }
            if (ErrorMsg.Length != 0)
            {
                hash ^= ErrorMsg.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
        public CreateTaskResponse(dynamic json)
        {
            ErrorId = JsonHelper.ExtractInt(json, "errorId");

            if (ErrorId != null)
            {
                if (ErrorId.Equals(0))
                {
                    TaskId = JsonHelper.ExtractInt(json, "taskId");
                }
                else
                {
                    ErrorCode        = JsonHelper.ExtractStr(json, "errorCode");
                    ErrorDescription = JsonHelper.ExtractStr(json, "errorDescription") ?? "(no error description)";
                }
            }
            else
            {
                DebugHelper.Out(DebugHelper.Severity.Error, "Unknown error");
            }
        }
        public BalanceResponse(dynamic json)
        {
            ErrorId = JsonHelper.ExtractInt(json, "errorId");

            if (ErrorId != null)
            {
                if (ErrorId.Equals(0))
                {
                    Balance = JsonHelper.ExtractDouble(json, "balance");
                }
                else
                {
                    ErrorCode        = JsonHelper.ExtractStr(json, "errorCode");
                    ErrorDescription = JsonHelper.ExtractStr(json, "errorDescription") ?? "(no error description)";
                }
            }
            else
            {
                DebugHelper.Out("Unknown error", DebugHelper.Type.Error);
            }
        }
Exemple #32
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Width != 0)
            {
                hash ^= Width.GetHashCode();
            }
            if (Height != 0)
            {
                hash ^= Height.GetHashCode();
            }
            if (ChannelCount != 0)
            {
                hash ^= ChannelCount.GetHashCode();
            }
            if (Raw.Length != 0)
            {
                hash ^= Raw.GetHashCode();
            }
            hash ^= rois_.GetHashCode();
            if (SolutionId != 0)
            {
                hash ^= SolutionId.GetHashCode();
            }
            if (ErrorId != 0)
            {
                hash ^= ErrorId.GetHashCode();
            }
            if (Key.Length != 0)
            {
                hash ^= Key.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Exemple #33
0
        public IntPtr DeserializeDelegationKey(byte[] buffer)
        {
            IntPtr delegationKey;
            this.errorId = LibpreWrapper.DeserializeDelegationKey(buffer, buffer.Length, out delegationKey, this.scheme);
            AssertSuccess();

            return delegationKey;
        }
Exemple #34
0
        public IntPtr GenerateDelegationKey(IntPtr privateKeyForDelegator, IntPtr publicKeyForDelegatee)
        {
            IntPtr delegationKey;
            this.errorId = LibpreWrapper.GenerateDelegationKey(this.parameters, privateKeyForDelegator, publicKeyForDelegatee, out delegationKey, this.scheme);
            AssertSuccess();

            return delegationKey;
        }
Exemple #35
0
 public void DeleteDelegationKey(IntPtr delegationKey)
 {
     this.errorId = LibpreWrapper.DestroyDelegationKey(delegationKey, this.scheme);
     AssertSuccess();
 }
Exemple #36
0
        public byte[] Reencrypt(IntPtr delegationKey, byte[] cipherText)
        {
            int newCipherTextSize = this.tempBuf.Length;
            this.errorId = LibpreWrapper.Reencrypt(this.parameters, delegationKey, cipherText, cipherText.Length, this.tempBuf, ref newCipherTextSize, this.scheme);
            AssertSuccess();

            return tempBuf.RangeSubset(0, newCipherTextSize);
        }
Exemple #37
0
        public byte[] SerializePublicKey(IntPtr publicKey)
        {
            int bytesWritten;
            this.errorId = LibpreWrapper.SerializePublicKey(this.parameters, publicKey, this.tempBuf, out bytesWritten, this.tempBuf.Length, this.scheme);
            AssertSuccess();

            return this.tempBuf.RangeSubset(0, bytesWritten);
        }
Exemple #38
0
        private IntPtr DeserializeParams(byte[] buffer)
        {
            IntPtr par;
            this.errorId = LibpreWrapper.DeserializeParams(buffer, buffer.Length, out par, this.scheme);
            AssertSuccess();

            return par;
        }
Exemple #39
0
 private void HandleError(ErrorId errorId, string message)
 {
     HandleError(SourceRange.None, errorId, message);
 }
Exemple #40
0
 private void HandleError(SourceRange sourceRange, ErrorId errorId, string message)
 {
     OnError(new CompilationError(sourceRange, errorId, message));
 }
Exemple #41
0
        public byte[] Encrypt(IntPtr publicKey, byte[] plaintext)
        {
            int cipherTextSize = this.tempBuf.Length;
            this.errorId = LibpreWrapper.Encrypt(this.parameters, publicKey, plaintext, plaintext.Length, this.tempBuf, ref cipherTextSize, CiphertextType.SecondLevel, this.scheme);
            AssertSuccess();

            return tempBuf.RangeSubset(0, cipherTextSize);
        }
Exemple #42
0
 public void DeletePublicKey(IntPtr publicKey)
 {
     this.errorId = LibpreWrapper.DestroyKeys(this.parameters, publicKey, IntPtr.Zero, this.scheme);
     AssertSuccess();
 }
Exemple #43
0
 public void DeleteKeyPair(InMemoryKeyPair keys)
 {
     this.errorId = LibpreWrapper.DestroyKeys(this.parameters, keys.PublicKey, keys.PrivateKey, this.scheme);
     AssertSuccess();
 }
Exemple #44
0
 public void DeleteDelegationKey(IntPtr delegationKey)
 {
     this.errorId = LibpreWrapper.DestroyDelegationKey(delegationKey, this.scheme);
     AssertSuccess();
 }
Exemple #45
0
        //private void DeleteParams(IntPtr par)
        //{
        //    this.errorId = LibpreWrapper.DestroyParams(par);
        //    AssertSuccess();
        //}
        public InMemoryKeyPair GenerateKeyPair()
        {
            IntPtr publicKey;
            IntPtr privateKey;
            this.errorId = LibpreWrapper.GenerateKeys(this.parameters, out publicKey, out privateKey, this.scheme);
            AssertSuccess();

            return new InMemoryKeyPair(publicKey, privateKey);
        }
Exemple #46
0
        public IntPtr DeserializePublicKey(byte[] buffer)
        {
            IntPtr publicKey;
            this.errorId = LibpreWrapper.DeserializePublicKey(this.parameters, buffer, buffer.Length, out publicKey, this.scheme);
            AssertSuccess();

            return publicKey;
        }