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
- EntityProviderServices.cs
- TraceContext.cs
- RadioButtonList.cs
- WebPartConnectionsDisconnectVerb.cs
- ClassDataContract.cs
- XmlNodeChangedEventArgs.cs
- TemplateKey.cs
- WebResponse.cs
- ResourcePart.cs
- ReaderOutput.cs
- CodeGotoStatement.cs
- ConfigurationPropertyCollection.cs
- SQLMoney.cs
- xmlformatgeneratorstatics.cs
- TextModifier.cs
- SessionStateUtil.cs
- RecipientInfo.cs
- XmlBinaryReader.cs
- FloatUtil.cs
- TemplatedWizardStep.cs
- AggregatePushdown.cs
- InterleavedZipPartStream.cs
- ArgumentException.cs
- DataPagerFieldItem.cs
- XmlIgnoreAttribute.cs
- RoutedEvent.cs
- IDQuery.cs
- XDRSchema.cs
- DocumentPaginator.cs
- CachingHintValidation.cs
- CacheManager.cs
- InkPresenterAutomationPeer.cs
- unsafenativemethodstextservices.cs
- ThrowHelper.cs
- DeploymentSection.cs
- CheckBoxList.cs
- PrincipalPermission.cs
- XmlChoiceIdentifierAttribute.cs
- SizeIndependentAnimationStorage.cs
- SystemUdpStatistics.cs
- Label.cs
- ObjectSet.cs
- StrongNameIdentityPermission.cs
- ThreadPool.cs
- TypeConvertions.cs
- Vector3DCollectionConverter.cs
- FormatConvertedBitmap.cs
- InputScopeAttribute.cs
- CharEnumerator.cs
- RawStylusInputReport.cs
- DecimalAnimationBase.cs
- DataRowExtensions.cs
- XPathMultyIterator.cs
- MDIControlStrip.cs
- IsolatedStorageFile.cs
- Utilities.cs
- AnnotationObservableCollection.cs
- ConfigurationLockCollection.cs
- CorePropertiesFilter.cs
- TablePatternIdentifiers.cs
- GeneralTransform3D.cs
- ControlPaint.cs
- DataSourceCacheDurationConverter.cs
- SimpleHandlerBuildProvider.cs
- ZipIOExtraFieldZip64Element.cs
- ClrProviderManifest.cs
- Merger.cs
- isolationinterop.cs
- MulticastOption.cs
- MediaElementAutomationPeer.cs
- XmlAnyElementAttribute.cs
- SatelliteContractVersionAttribute.cs
- InputProcessorProfilesLoader.cs
- DbProviderSpecificTypePropertyAttribute.cs
- IdentityHolder.cs
- RootBrowserWindowProxy.cs
- SqlProviderUtilities.cs
- XmlSchemaExternal.cs
- ListViewVirtualItemsSelectionRangeChangedEvent.cs
- OdbcCommand.cs
- AppSecurityManager.cs
- SByte.cs
- LinkArea.cs
- Ref.cs
- SiteMapNode.cs
- AdPostCacheSubstitution.cs
- BitmapEncoder.cs
- OdbcParameterCollection.cs
- Connection.cs
- AutomationPropertyInfo.cs
- XmlLoader.cs
- UserControlCodeDomTreeGenerator.cs
- PasswordTextNavigator.cs
- PropertyGridView.cs
- DesignerLoader.cs
- CollectionChangedEventManager.cs
- EntityModelBuildProvider.cs
- WebErrorHandler.cs
- PasswordRecoveryDesigner.cs
- XmlSortKey.cs