Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / ndp / clr / src / BCL / System / Security / Cryptography / RijndaelManaged.cs / 1 / RijndaelManaged.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== // // RijndaelManaged.cs // namespace System.Security.Cryptography { [System.Runtime.InteropServices.ComVisible(true)] public sealed class RijndaelManaged : Rijndael { public RijndaelManaged () { if (Utils.FipsAlgorithmPolicy == 1) throw new InvalidOperationException(Environment.GetResourceString("Cryptography_NonCompliantFIPSAlgorithm")); } public override ICryptoTransform CreateEncryptor (byte[] rgbKey, byte[] rgbIV) { return NewEncryptor (rgbKey, ModeValue, rgbIV, FeedbackSizeValue, RijndaelManagedTransformMode.Encrypt); } public override ICryptoTransform CreateDecryptor (byte[] rgbKey, byte[] rgbIV) { return NewEncryptor (rgbKey, ModeValue, rgbIV, FeedbackSizeValue, RijndaelManagedTransformMode.Decrypt); } public override void GenerateKey () { KeyValue = new byte[KeySizeValue/8]; Utils.StaticRandomNumberGenerator.GetBytes(KeyValue); } public override void GenerateIV () { IVValue = new byte[BlockSizeValue/8]; Utils.StaticRandomNumberGenerator.GetBytes(IVValue); } private ICryptoTransform NewEncryptor (byte[] rgbKey, CipherMode mode, byte[] rgbIV, int feedbackSize, RijndaelManagedTransformMode encryptMode) { // Build the key if one does not already exist if (rgbKey == null) { rgbKey = new byte[KeySizeValue/8]; Utils.StaticRandomNumberGenerator.GetBytes(rgbKey); } // If not ECB mode, make sure we have an IV if (mode != CipherMode.ECB) { if (rgbIV == null) { rgbIV = new byte[BlockSizeValue/8]; Utils.StaticRandomNumberGenerator.GetBytes(rgbIV); } } // Create the encryptor/decryptor object return new RijndaelManagedTransform (rgbKey, mode, rgbIV, BlockSizeValue, feedbackSize, PaddingValue, encryptMode); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- LongAverageAggregationOperator.cs
- ProgressPage.cs
- QueueProcessor.cs
- TextWriter.cs
- Assert.cs
- SyndicationDeserializer.cs
- CustomSignedXml.cs
- HMACSHA1.cs
- StringBuilder.cs
- ExpressionBuilderCollection.cs
- Matrix.cs
- ChannelBinding.cs
- BezierSegment.cs
- LayoutUtils.cs
- ImportOptions.cs
- HttpHandlerActionCollection.cs
- WSTrust.cs
- Cursor.cs
- CreateUserWizardStep.cs
- CodeAccessPermission.cs
- ResourcePool.cs
- MarkupCompiler.cs
- Property.cs
- PropertyManager.cs
- UnitySerializationHolder.cs
- DictionaryItemsCollection.cs
- IntAverageAggregationOperator.cs
- HttpApplicationFactory.cs
- MessageQueueKey.cs
- NavigationHelper.cs
- SemanticAnalyzer.cs
- PngBitmapDecoder.cs
- DoubleAnimationClockResource.cs
- XLinq.cs
- LineServices.cs
- HttpCapabilitiesSectionHandler.cs
- WsiProfilesElement.cs
- TileBrush.cs
- StructuredTypeInfo.cs
- ListBox.cs
- ElapsedEventArgs.cs
- CachedPathData.cs
- DataViewManager.cs
- HostingEnvironmentSection.cs
- AccessorTable.cs
- DecoderBestFitFallback.cs
- WebBrowserNavigatingEventHandler.cs
- MenuItemAutomationPeer.cs
- _LoggingObject.cs
- Viewport2DVisual3D.cs
- WindowsPen.cs
- RedirectionProxy.cs
- FontStyles.cs
- TextSelectionHelper.cs
- ExtendedProtectionPolicy.cs
- HttpHandlersSection.cs
- CompiledQuery.cs
- DataGridViewRowStateChangedEventArgs.cs
- XmlSerializationWriter.cs
- ServiceModelEnumValidatorAttribute.cs
- MessageDroppedTraceRecord.cs
- Tool.cs
- ReliableMessagingHelpers.cs
- FixedMaxHeap.cs
- TimeSpanParse.cs
- serverconfig.cs
- PackageFilter.cs
- SafeEventLogWriteHandle.cs
- GridViewSelectEventArgs.cs
- MessageRpc.cs
- RemotingServices.cs
- UIPermission.cs
- SiteMap.cs
- ReliabilityContractAttribute.cs
- NameValuePair.cs
- XmlSchemaException.cs
- WindowsToolbarItemAsMenuItem.cs
- IdentitySection.cs
- WindowsTitleBar.cs
- DataGridViewButtonColumn.cs
- FlowLayout.cs
- PropertyFilterAttribute.cs
- TTSVoice.cs
- OutOfMemoryException.cs
- FreeFormPanel.cs
- ExcCanonicalXml.cs
- LogPolicy.cs
- DecimalAnimationBase.cs
- EventBindingService.cs
- Avt.cs
- ContentPresenter.cs
- SkinBuilder.cs
- HttpCookie.cs
- CompilerScope.cs
- Int16Converter.cs
- GenericIdentity.cs
- UnsafeNativeMethods.cs
- SspiSafeHandles.cs
- VariableReference.cs
- PauseStoryboard.cs