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
- ResourcesBuildProvider.cs
- TimeoutException.cs
- COMException.cs
- DataGridViewTextBoxEditingControl.cs
- SchemaAttDef.cs
- ToolboxItemFilterAttribute.cs
- UTF32Encoding.cs
- SystemGatewayIPAddressInformation.cs
- DesignerDataView.cs
- TableStyle.cs
- webclient.cs
- DispatcherExceptionEventArgs.cs
- GeneralTransform3D.cs
- EpmTargetTree.cs
- VersionedStream.cs
- DbInsertCommandTree.cs
- DetailsView.cs
- SqlFactory.cs
- ToggleButtonAutomationPeer.cs
- WebPartUserCapability.cs
- DataGridViewCellStyleChangedEventArgs.cs
- AssemblyUtil.cs
- BoundsDrawingContextWalker.cs
- GenericEnumerator.cs
- FileLevelControlBuilderAttribute.cs
- UniqueIdentifierService.cs
- SqlStream.cs
- XamlStream.cs
- TabControlEvent.cs
- HandleRef.cs
- DeferredSelectedIndexReference.cs
- XmlSignificantWhitespace.cs
- GridProviderWrapper.cs
- DictionarySectionHandler.cs
- UIElementPropertyUndoUnit.cs
- WindowsScrollBarBits.cs
- NoneExcludedImageIndexConverter.cs
- httpserverutility.cs
- ErrorFormatter.cs
- TreeNodeStyleCollection.cs
- NetworkInformationPermission.cs
- NativeMethodsCLR.cs
- TaskHelper.cs
- MdiWindowListStrip.cs
- SystemException.cs
- EntityRecordInfo.cs
- TextContainer.cs
- Console.cs
- EventLog.cs
- isolationinterop.cs
- SynchronizingStream.cs
- BitmapFrame.cs
- CodeTypeReference.cs
- PageTheme.cs
- ObjectDataSourceMethodEventArgs.cs
- HWStack.cs
- Lock.cs
- XmlAttributeProperties.cs
- SoapParser.cs
- _WinHttpWebProxyDataBuilder.cs
- DataGridViewSelectedCellCollection.cs
- Stacktrace.cs
- SimpleMailWebEventProvider.cs
- ModuleBuilderData.cs
- AppModelKnownContentFactory.cs
- _FtpControlStream.cs
- HttpMethodAttribute.cs
- BinaryWriter.cs
- MediaPlayerState.cs
- xmlsaver.cs
- LostFocusEventManager.cs
- ExceptionHelpers.cs
- EventLogInternal.cs
- PositiveTimeSpanValidatorAttribute.cs
- StateManagedCollection.cs
- ProtocolElement.cs
- MenuItemBinding.cs
- TableDetailsCollection.cs
- SmtpReplyReader.cs
- MetadataCache.cs
- IERequestCache.cs
- DriveInfo.cs
- ContentAlignmentEditor.cs
- RuntimeHandles.cs
- ClientApiGenerator.cs
- SystemThemeKey.cs
- StylusPointPropertyInfoDefaults.cs
- wmiprovider.cs
- TemplateComponentConnector.cs
- BufferedResponseStream.cs
- PaintValueEventArgs.cs
- CacheRequest.cs
- PenThreadPool.cs
- PrivilegeNotHeldException.cs
- MeshGeometry3D.cs
- CharAnimationUsingKeyFrames.cs
- DESCryptoServiceProvider.cs
- LogicalTreeHelper.cs
- ColorConverter.cs
- TransformerConfigurationWizardBase.cs