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
- TransactionOptions.cs
- DynamicResourceExtension.cs
- TemporaryBitmapFile.cs
- TransactionScopeDesigner.cs
- XpsSerializationException.cs
- CodeDirectiveCollection.cs
- FunctionDescription.cs
- ClonableStack.cs
- StrokeCollectionConverter.cs
- Version.cs
- ParameterElement.cs
- __ConsoleStream.cs
- _ConnectionGroup.cs
- InfoCardRSACryptoProvider.cs
- ToolStripSplitButton.cs
- WindowAutomationPeer.cs
- EdmError.cs
- nulltextnavigator.cs
- WindowsTokenRoleProvider.cs
- odbcmetadatacolumnnames.cs
- TimeSpanValidatorAttribute.cs
- StateRuntime.cs
- EnumBuilder.cs
- COM2TypeInfoProcessor.cs
- ProfileInfo.cs
- WindowsComboBox.cs
- ObjectContext.cs
- NullableIntAverageAggregationOperator.cs
- PropertySegmentSerializationProvider.cs
- DataGridViewColumnStateChangedEventArgs.cs
- EncoderReplacementFallback.cs
- VectorValueSerializer.cs
- XPathNavigatorKeyComparer.cs
- WindowsIdentity.cs
- PerspectiveCamera.cs
- DBDataPermission.cs
- SpeechRecognitionEngine.cs
- Missing.cs
- ResourceManagerWrapper.cs
- TableParagraph.cs
- SoapParser.cs
- documentsequencetextview.cs
- SmtpMail.cs
- FrameworkReadOnlyPropertyMetadata.cs
- NameValueConfigurationElement.cs
- ContextMenu.cs
- ServiceDocument.cs
- TypeConstant.cs
- ConsoleKeyInfo.cs
- BaseValidatorDesigner.cs
- CaseDesigner.xaml.cs
- Animatable.cs
- ValueProviderWrapper.cs
- ObfuscationAttribute.cs
- StorageEndPropertyMapping.cs
- DataMemberConverter.cs
- IIS7WorkerRequest.cs
- WebBrowserNavigatingEventHandler.cs
- TextProperties.cs
- CurrencyWrapper.cs
- SystemIPGlobalStatistics.cs
- SafeProcessHandle.cs
- propertytag.cs
- FileRecordSequence.cs
- KeyInstance.cs
- Configuration.cs
- HealthMonitoringSectionHelper.cs
- MessageLogger.cs
- ManagementObject.cs
- DataSvcMapFileSerializer.cs
- SeparatorAutomationPeer.cs
- WebColorConverter.cs
- ClientFormsIdentity.cs
- RegexInterpreter.cs
- PlainXmlDeserializer.cs
- OdbcEnvironment.cs
- TextContainerChangedEventArgs.cs
- ComponentResourceKeyConverter.cs
- ManipulationStartingEventArgs.cs
- BookmarkTable.cs
- WindowVisualStateTracker.cs
- DesignerAttribute.cs
- DelegateCompletionCallbackWrapper.cs
- UnitySerializationHolder.cs
- DbTypeMap.cs
- RegionData.cs
- DiagnosticsElement.cs
- ConnectionOrientedTransportChannelListener.cs
- PasswordDeriveBytes.cs
- SiteMapDataSource.cs
- TreeViewImageGenerator.cs
- Style.cs
- BufferModeSettings.cs
- ConditionChanges.cs
- CodeConstructor.cs
- AppDomainFactory.cs
- DesignTimeType.cs
- Win32SafeHandles.cs
- JoinCqlBlock.cs
- FixedSOMPageElement.cs