Пример #1
0
        public IntPtr DeserializePublicKey(byte[] buffer)
        {
            IntPtr publicKey;

            this.errorId = LibpreWrapper.DeserializePublicKey(this.parameters, buffer, buffer.Length, out publicKey, this.scheme);
            AssertSuccess();

            return(publicKey);
        }
Пример #2
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));
        }
Пример #3
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);
            }
        }
Пример #4
0
 public void DeleteDelegationKey(IntPtr delegationKey)
 {
     this.errorId = LibpreWrapper.DestroyDelegationKey(delegationKey, this.scheme);
     AssertSuccess();
 }
Пример #5
0
 public void DeletePrivateKey(IntPtr privateKey)
 {
     this.errorId = LibpreWrapper.DestroyKeys(this.parameters, IntPtr.Zero, privateKey, this.scheme);
     AssertSuccess();
 }
Пример #6
0
 public void DeleteKeyPair(InMemoryKeyPair keys)
 {
     this.errorId = LibpreWrapper.DestroyKeys(this.parameters, keys.PublicKey, keys.PrivateKey, this.scheme);
     AssertSuccess();
 }