Esempio n. 1
0
        public unsafe SecStatusCode RawVerify(SecPadding padding, IntPtr signedData, int signedDataLen, IntPtr signature, int signatureLen)
        {
            if (handle == IntPtr.Zero)
            {
                throw new ObjectDisposedException("SecKey");
            }

            return(SecKeyRawVerify(handle, padding, signedData, (nint)signedDataLen, signature, (nint)signatureLen));
        }
Esempio n. 2
0
        public unsafe SecStatusCode Decrypt(SecPadding padding, IntPtr cipherText, nint cipherTextLen, IntPtr plainText, ref nint plainTextLen)
        {
            if (handle == IntPtr.Zero)
            {
                throw new ObjectDisposedException("SecKey");
            }

            return(SecKeyDecrypt(handle, padding, cipherText, cipherTextLen, plainText, ref plainTextLen));
        }
Esempio n. 3
0
        public unsafe SecStatusCode Encrypt(SecPadding padding, IntPtr plainText, int playLen, IntPtr cipherText, int cipherLen)
        {
            if (handle == IntPtr.Zero)
            {
                throw new ObjectDisposedException("SecKey");
            }

            return(SecKeyEncrypt(handle, padding, plainText, (IntPtr)playLen, cipherText, (IntPtr)cipherLen));
        }
Esempio n. 4
0
 SecStatusCode RawSign(SecPadding padding, IntPtr dataToSign, int dataToSignLen, out byte [] result)
 {
     ThrowIfDisposed();
     result = new byte [(int)SecKeyGetBlockSize(Handle)];
     unsafe {
         fixed(byte *p = &result[0])
         return(SecKeyRawSign(Handle, padding, dataToSign, (IntPtr)dataToSignLen, (IntPtr)p, (IntPtr)result.Length));
     }
 }
Esempio n. 5
0
        public SecStatusCode Decrypt(SecPadding padding, byte [] cipherText, byte [] plainText)
        {
            if (plainText == null)
            {
                throw new ArgumentNullException("plainText");
            }

            return(_Decrypt(padding, cipherText, ref plainText));
        }
Esempio n. 6
0
        SecStatusCode RawSign(SecPadding padding, IntPtr dataToSign, int dataToSignLen, out byte [] result)
        {
            if (handle == IntPtr.Zero)
            {
                throw new ObjectDisposedException("SecKey");
            }

            result = new byte [(int)SecKeyGetBlockSize(handle)];
            unsafe {
                fixed(byte *p = &result[0])
                return(SecKeyRawSign(handle, padding, dataToSign, (IntPtr)dataToSignLen, (IntPtr)p, (IntPtr)result.Length));
            }
        }
Esempio n. 7
0
        public SecStatusCode RawSign(SecPadding padding, IntPtr dataToSign, int dataToSignLen, out byte [] result)
        {
            if (handle == IntPtr.Zero)
            {
                throw new ObjectDisposedException("SecKey");
            }
            if (dataToSign == IntPtr.Zero)
            {
                throw new ArgumentException("dataToSign");
            }

            return(_RawSign(padding, dataToSign, dataToSignLen, out result));
        }
Esempio n. 8
0
        SecStatusCode RawSign(SecPadding padding, byte [] dataToSign, out byte [] result)
        {
            ThrowIfDisposed();
            if (dataToSign == null)
            {
                throw new ArgumentNullException("dataToSign");
            }

            result = new byte [(int)SecKeyGetBlockSize(Handle)];
            unsafe
            {
                fixed(byte *bp = &dataToSign[0]) {
                    fixed(byte *p = &result[0])
                    return(SecKeyRawSign(Handle, padding, (IntPtr)bp, (IntPtr)dataToSign.Length, (IntPtr)p, (IntPtr)result.Length));
                }
            }
        }
Esempio n. 9
0
 public SecStatusCode Decrypt(SecPadding padding, byte [] cipherText, byte [] plainText)
 {
     ThrowIfDisposed();
     if (cipherText == null)
     {
         throw new ArgumentNullException("cipherText");
     }
     if (plainText == null)
     {
         throw new ArgumentNullException("plainText");
     }
     unsafe
     {
         fixed(byte *cp = &cipherText[0])
         {
             fixed(byte *pp = &plainText[0])
             {
                 return(SecKeyDecrypt(Handle, padding, (IntPtr)cp, (IntPtr)cipherText.Length, (IntPtr)pp, (IntPtr)plainText.Length));
             }
         }
     }
 }
Esempio n. 10
0
 public SecStatusCode RawVerify(SecPadding padding, byte [] signedData, byte [] signature)
 {
     ThrowIfDisposed();
     if (signature == null)
     {
         throw new ArgumentNullException("signature");
     }
     if (signedData == null)
     {
         throw new ArgumentNullException("signedData");
     }
     unsafe
     {
         fixed(byte *sp = &signature[0])
         {
             fixed(byte *dp = &signedData[0])
             {
                 return(SecKeyRawVerify(Handle, padding, (IntPtr)dp, (IntPtr)signedData.Length, (IntPtr)sp, (IntPtr)signature.Length));
             }
         }
     }
 }
Esempio n. 11
0
        public SecStatusCode RawVerify(SecPadding padding, byte [] signedData, byte [] signature)
        {
            if (handle == IntPtr.Zero)
            {
                throw new ObjectDisposedException("SecKey");
            }

            if (signature == null)
            {
                throw new ArgumentNullException("signature");
            }
            if (signedData == null)
            {
                throw new ArgumentNullException("signedData");
            }
            unsafe
            {
                fixed(byte *sp = signature)
                fixed(byte *dp = signedData)
                {
                    return(SecKeyRawVerify(handle, padding, (IntPtr)dp, (nint)signedData.Length, (IntPtr)sp, (nint)signature.Length));
                }
            }
        }
Esempio n. 12
0
 static extern SecStatusCode SecKeyRawSign(IntPtr handle, SecPadding padding, IntPtr dataToSign, IntPtr dataToSignLen, IntPtr sig, IntPtr sigLen);
Esempio n. 13
0
        public SecStatusCode RawVerify(SecPadding padding, byte [] signedData, byte [] signature)
        {
            if (handle == IntPtr.Zero)
                throw new ObjectDisposedException ("SecKey");

            if (signature == null)
                throw new ArgumentNullException ("signature");
            if (signedData == null)
                throw new ArgumentNullException ("signedData");
            unsafe {
                fixed (byte *sp = &signature[0]){
                    fixed (byte *dp = &signedData [0]){
                        return SecKeyRawVerify (handle, padding, (IntPtr) dp, (IntPtr) signedData.Length, (IntPtr) sp, (IntPtr) signature.Length);
                    }
                }
            }
        }
Esempio n. 14
0
        public SecStatusCode Encrypt(SecPadding padding, byte [] plainText, byte [] cipherText)
        {
            if (handle == IntPtr.Zero)
                throw new ObjectDisposedException ("SecKey");

            if (cipherText == null)
                throw new ArgumentNullException ("cipherText");
            if (plainText == null)
                throw new ArgumentNullException ("plainText");
            unsafe {
                fixed (byte *cp = &cipherText[0]){
                    fixed (byte *pp = &plainText [0]){
                        return SecKeyEncrypt (handle, padding, (IntPtr) pp, (IntPtr) plainText.Length, (IntPtr) cp, (IntPtr) cipherText.Length);
                    }
                }
            }
        }
Esempio n. 15
0
 extern static SecStatusCode SecKeyDecrypt(IntPtr handle, SecPadding padding, IntPtr cipherTextLen, nint cipherLen, IntPtr plainText, ref nint plainTextLen);
Esempio n. 16
0
 public SecStatusCode Decrypt(SecPadding padding, byte [] cipherText, out byte [] plainText)
 {
     plainText = null;
     return(_Decrypt(padding, cipherText, ref plainText));
 }
Esempio n. 17
0
		public SecStatusCode Decrypt (SecPadding padding, byte [] cipherText, byte [] plainText)
		{
			ThrowIfDisposed ();
			if (cipherText == null)
				throw new ArgumentNullException ("cipherText");
			if (plainText == null)
				throw new ArgumentNullException ("plainText");
			unsafe {
				fixed (byte *cp = &cipherText[0]){
					fixed (byte *pp = &plainText [0]){
						return SecKeyDecrypt (Handle, padding, (IntPtr) cp, (IntPtr) cipherText.Length, (IntPtr) pp, (IntPtr) plainText.Length);
					}
				}
			}
		}
Esempio n. 18
0
		SecStatusCode _Decrypt (SecPadding padding, byte [] cipherText, ref byte [] plainText)
		{
			if (handle == IntPtr.Zero)
				throw new ObjectDisposedException ("SecKey");

			if (cipherText == null)
				throw new ArgumentNullException ("cipherText");
		
			unsafe {
				fixed (byte *cp = cipherText) {
					if (plainText == null)
						plainText = new byte [cipherText.Length];
					nint len = plainText.Length;
					SecStatusCode status;
					fixed (byte *pp = plainText)
						status = SecKeyDecrypt (handle, padding, (IntPtr)cp, (nint)cipherText.Length, (IntPtr)pp, ref len);
					if (len < plainText.Length)
						Array.Resize<byte> (ref plainText, (int) len);
					return status;
				}
			}
		}
Esempio n. 19
0
        SecStatusCode RawSign(SecPadding padding, IntPtr dataToSign, int dataToSignLen, out byte [] result)
        {
            if (handle == IntPtr.Zero)
                throw new ObjectDisposedException ("SecKey");

            result = new byte [(int) SecKeyGetBlockSize (handle)];
            unsafe {
                fixed (byte *p = &result [0])
                    return SecKeyRawSign (handle, padding, dataToSign, (IntPtr) dataToSignLen, (IntPtr) p, (IntPtr)result.Length);
            }
        }
Esempio n. 20
0
 public unsafe SecStatusCode Decrypt(SecPadding padding, IntPtr cipherText, int cipherLen, IntPtr plainText, int playLen)
 {
     ThrowIfDisposed();
     return(SecKeyDecrypt(Handle, padding, cipherText, (IntPtr)cipherLen, plainText, (IntPtr)playLen));
 }
Esempio n. 21
0
 public unsafe SecStatusCode RawVerify(SecPadding padding, IntPtr signedData, int signedDataLen, IntPtr signature, int signatureLen)
 {
     ThrowIfDisposed();
     return(SecKeyRawVerify(Handle, padding, signedData, (IntPtr)signedDataLen, signature, (IntPtr)signatureLen));
 }
Esempio n. 22
0
		public unsafe SecStatusCode RawVerify (SecPadding padding, IntPtr signedData, int signedDataLen, IntPtr signature, int signatureLen)
		{
			ThrowIfDisposed ();
			return SecKeyRawVerify (Handle, padding, signedData, (IntPtr) signedDataLen, signature, (IntPtr) signatureLen);
		}
Esempio n. 23
0
		public SecStatusCode Decrypt (SecPadding padding, byte [] cipherText, out byte [] plainText)
		{
			plainText = null;
			return _Decrypt (padding, cipherText, ref plainText);
		}
Esempio n. 24
0
		public SecStatusCode Decrypt (SecPadding padding, byte [] cipherText, byte [] plainText)
		{
			if (plainText == null)
				throw new ArgumentNullException ("plainText");

			return _Decrypt (padding, cipherText, ref plainText);
		}
Esempio n. 25
0
		public unsafe SecStatusCode Decrypt (SecPadding padding, IntPtr cipherText, int cipherLen, IntPtr plainText, int playLen)
		{
			ThrowIfDisposed ();
			return SecKeyDecrypt (Handle, padding, cipherText, (IntPtr) cipherLen, plainText, (IntPtr) playLen);
		}
Esempio n. 26
0
 private static extern SecStatusCode SecKeyDecrypt(IntPtr handle, SecPadding padding, IntPtr cipherText, int cipherTextLen, IntPtr plainText, ref int plainTextLen);
Esempio n. 27
0
 private static extern SecStatusCode SecKeyDecrypt(IntPtr handle, SecPadding padding, IntPtr cipherText, int cipherTextLen, IntPtr plainText, ref int plainTextLen);
Esempio n. 28
0
 extern static SecStatusCode SecKeyEncrypt(IntPtr handle, SecPadding padding, IntPtr plainText, IntPtr playLen, IntPtr cipherText, IntPtr cipherLen);
Esempio n. 29
0
 private static extern SecStatusCode SecKeyRawSign(IntPtr handle, SecPadding padding, IntPtr dataToSign, int dataToSignLen, IntPtr sig, ref int sigLen);
Esempio n. 30
0
 extern static SecStatusCode SecKeyRawSign(IntPtr handle, SecPadding padding, IntPtr dataToSign, nint dataToSignLen, IntPtr sig, ref nint sigLen);
Esempio n. 31
0
		extern static SecStatusCode SecKeyRawSign (IntPtr handle, SecPadding padding, IntPtr dataToSign, nint dataToSignLen, IntPtr sig, ref nint sigLen);
Esempio n. 32
0
 extern static SecStatusCode SecKeyRawVerify(IntPtr handle, SecPadding padding, IntPtr signedData, nint signedLen, IntPtr sign, nint signLen);
Esempio n. 33
0
		public SecStatusCode RawSign (SecPadding padding, IntPtr dataToSign, int dataToSignLen, out byte [] result)
		{
			if (handle == IntPtr.Zero)
				throw new ObjectDisposedException ("SecKey");
			if (dataToSign == IntPtr.Zero)
				throw new ArgumentException ("dataToSign");

			return _RawSign (padding, dataToSign, dataToSignLen, out result);
		}
Esempio n. 34
0
 public SecStatusCode Encrypt(SecPadding padding, byte [] plainText, out byte [] cipherText)
 {
     cipherText = new byte [BlockSize];
     return(Encrypt(padding, plainText, cipherText));
 }
Esempio n. 35
0
		public unsafe SecStatusCode RawSign (SecPadding padding, byte [] dataToSign, out byte [] result)
		{
			if (handle == IntPtr.Zero)
				throw new ObjectDisposedException ("SecKey");
			if (dataToSign == null)
				throw new ArgumentNullException ("dataToSign");

			fixed (byte *bp = dataToSign)
				return _RawSign (padding, (IntPtr) bp, dataToSign.Length, out result);
		}
Esempio n. 36
0
        public unsafe SecStatusCode Encrypt(SecPadding padding, IntPtr plainText, int playLen, IntPtr cipherText, int cipherLen)
        {
            if (handle == IntPtr.Zero)
                throw new ObjectDisposedException ("SecKey");

            return SecKeyEncrypt (handle, padding, plainText, (IntPtr) playLen, cipherText, (IntPtr) cipherLen);
        }
Esempio n. 37
0
		unsafe SecStatusCode _RawSign (SecPadding padding, IntPtr dataToSign, int dataToSignLen, out byte [] result)
		{
			SecStatusCode status;
			nint len = 1024;
			result = new byte [len];
			fixed (byte *p = result) {
				status = SecKeyRawSign (handle, padding, dataToSign, dataToSignLen, (IntPtr) p, ref len);
				Array.Resize (ref result, (int) len);
			}
			return status;
		}
Esempio n. 38
0
        public unsafe SecStatusCode RawVerify(SecPadding padding, IntPtr signedData, int signedDataLen, IntPtr signature, int signatureLen)
        {
            if (handle == IntPtr.Zero)
                throw new ObjectDisposedException ("SecKey");

            return SecKeyRawVerify (handle, padding, signedData, (IntPtr) signedDataLen, signature, (IntPtr) signatureLen);
        }
Esempio n. 39
0
		public SecStatusCode Encrypt (SecPadding padding, byte [] plainText, out byte [] cipherText)
		{
			cipherText = new byte [BlockSize];
			return Encrypt (padding, plainText, cipherText);
		}
Esempio n. 40
0
 static extern SecStatusCode SecKeyEncrypt(IntPtr handle, SecPadding padding, IntPtr plainText, IntPtr playLen, IntPtr cipherText, IntPtr cipherLen);
Esempio n. 41
0
		extern static SecStatusCode SecKeyDecrypt (IntPtr handle, SecPadding padding, IntPtr cipherTextLen, nint cipherLen, IntPtr plainText, ref nint plainTextLen);
Esempio n. 42
0
 static extern SecStatusCode SecKeyRawVerify(IntPtr handle, SecPadding padding, IntPtr signedData, IntPtr signedLen, IntPtr sign, IntPtr signLen);
Esempio n. 43
0
		public unsafe SecStatusCode Decrypt (SecPadding padding, IntPtr cipherText, nint cipherTextLen, IntPtr plainText, ref nint plainTextLen)
		{
			if (handle == IntPtr.Zero)
				throw new ObjectDisposedException ("SecKey");

			return SecKeyDecrypt (handle, padding, cipherText, cipherTextLen, plainText, ref plainTextLen);
		}
Esempio n. 44
0
        SecStatusCode RawSign(SecPadding padding, byte [] dataToSign, out byte [] result)
        {
            if (handle == IntPtr.Zero)
                throw new ObjectDisposedException ("SecKey");
            if (dataToSign == null)
                throw new ArgumentNullException ("dataToSign");

            result = new byte [(int) SecKeyGetBlockSize (handle)];
            unsafe {
                fixed (byte *bp = &dataToSign [0]){
                    fixed (byte *p = &result [0])
                        return SecKeyRawSign (handle, padding, (IntPtr) bp, (IntPtr)dataToSign.Length, (IntPtr) p, (IntPtr) result.Length);
                }
            }
        }
Esempio n. 45
0
		SecStatusCode RawSign (SecPadding padding, IntPtr dataToSign, int dataToSignLen, out byte [] result)
		{
			ThrowIfDisposed ();
			result = new byte [(int) SecKeyGetBlockSize (Handle)];
			unsafe {
				fixed (byte *p = &result [0])
					return SecKeyRawSign (Handle, padding, dataToSign, (IntPtr) dataToSignLen, (IntPtr) p, (IntPtr)result.Length);
			}
		}