Example #1
0
        // helper method to reduce the amount of generate code for each cipher algorithm
        static internal IntPtr Create(CCOperation operation, CCAlgorithm algorithm, CCOptions options, byte[] key, byte[] iv)
        {
            if (key == null)
            {
                throw new CryptographicException("A null key was provided");
            }

            // unlike the .NET framework CommonCrypto does not support two-keys triple-des (128 bits) ref: #6967
            if ((algorithm == CCAlgorithm.TripleDES) && (key.Length == 16))
            {
                byte[] key3 = new byte [24];
                Buffer.BlockCopy(key, 0, key3, 0, 16);
                Buffer.BlockCopy(key, 0, key3, 16, 8);
                key = key3;
            }

            IntPtr          cryptor = IntPtr.Zero;
            CCCryptorStatus status  = Cryptor.CCCryptorCreate(operation, algorithm, options, key, (IntPtr)key.Length, iv, ref cryptor);

            if (status != CCCryptorStatus.Success)
            {
                throw new CryptographicUnexpectedOperationException();
            }
            return(cryptor);
        }
Example #2
0
		// helper method to reduce the amount of generate code for each cipher algorithm
		static internal IntPtr Create (CCOperation operation, CCAlgorithm algorithm, CCOptions options, byte[] key, byte[] iv)
		{
			if (key == null)
				throw new CryptographicException ("A null key was provided");
			
			// unlike the .NET framework CommonCrypto does not support two-keys triple-des (128 bits) ref: #6967
			if ((algorithm == CCAlgorithm.TripleDES) && (key.Length == 16)) {
				byte[] key3 = new byte [24];
				Buffer.BlockCopy (key, 0, key3, 0, 16);
				Buffer.BlockCopy (key, 0, key3, 16, 8);
				key = key3;
			}
			
			IntPtr cryptor = IntPtr.Zero;
			CCCryptorStatus status = Cryptor.CCCryptorCreate (operation, algorithm, options, key, (IntPtr) key.Length, iv, ref cryptor);
			if (status != CCCryptorStatus.Success)
				throw new CryptographicUnexpectedOperationException ();
			return cryptor;
		}
Example #3
0
 public ATreeLayoutAlgorithm(Digraph <Node, Edge> graph,
                             Box2F boundingBox)
     : base(graph, boundingBox)
 {
     this.mCCAlg = new CCAlgorithm <Node, Edge>(graph, false, false);
 }
Example #4
0
 public ATreeLayoutAlgorithm(Digraph <Node, Edge> graph,
                             IClusterNode clusterNode)
     : base(graph, clusterNode)
 {
     this.mCCAlg = new CCAlgorithm <Node, Edge>(graph, false, false);
 }
Example #5
0
		extern internal static CCCryptorStatus CCCryptorCreate (CCOperation op, CCAlgorithm alg, CCOptions options, /* const void* */ byte[] key, /* size_t */ IntPtr keyLength, /* const void* */ byte[] iv, /* CCCryptorRef* */ ref IntPtr cryptorRef);
Example #6
0
 extern internal static CCCryptorStatus CCCryptorCreate(CCOperation op, CCAlgorithm alg, CCOptions options, /* const void* */ byte[] key, /* size_t */ IntPtr keyLength, /* const void* */ byte[] iv, /* CCCryptorRef* */ ref IntPtr cryptorRef);