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
- SoapHeaderException.cs
- RuntimeEnvironment.cs
- ProcessProtocolHandler.cs
- DbConnectionFactory.cs
- PageAdapter.cs
- XmlObjectSerializerReadContext.cs
- WindowsStatusBar.cs
- ResXResourceSet.cs
- ProtectedConfigurationProviderCollection.cs
- DesignerVerb.cs
- Types.cs
- DictionaryGlobals.cs
- HostedElements.cs
- RegistrationServices.cs
- PersistenceTypeAttribute.cs
- mactripleDES.cs
- AssemblySettingAttributes.cs
- Axis.cs
- WindowsRebar.cs
- SqlXml.cs
- MLangCodePageEncoding.cs
- TextBoxLine.cs
- PolicyUtility.cs
- SvcMapFile.cs
- DataServiceBuildProvider.cs
- PrinterUnitConvert.cs
- CanExecuteRoutedEventArgs.cs
- DataTableMapping.cs
- FileInfo.cs
- CompilerTypeWithParams.cs
- RemotingException.cs
- Encoding.cs
- SharedPerformanceCounter.cs
- ConfigDefinitionUpdates.cs
- OleDbParameter.cs
- QueueProcessor.cs
- GenericIdentity.cs
- OleDbMetaDataFactory.cs
- StretchValidation.cs
- BaseInfoTable.cs
- MemoryResponseElement.cs
- Token.cs
- DiscoveryClientChannelFactory.cs
- Dispatcher.cs
- Pkcs7Signer.cs
- HttpBindingExtension.cs
- TypeUnloadedException.cs
- XmlTextEncoder.cs
- GenericWebPart.cs
- ExpandSegment.cs
- OrderedEnumerableRowCollection.cs
- CriticalFinalizerObject.cs
- DocComment.cs
- FontCollection.cs
- ListViewDeletedEventArgs.cs
- ObjectStateManagerMetadata.cs
- UpdatePanel.cs
- ISAPIWorkerRequest.cs
- LineServices.cs
- RelationshipEnd.cs
- ExceptionUtil.cs
- PowerStatus.cs
- ReceiveActivity.cs
- SqlWebEventProvider.cs
- TypeSource.cs
- KnownTypeDataContractResolver.cs
- XamlTreeBuilderBamlRecordWriter.cs
- OdbcConnectionStringbuilder.cs
- ContentHostHelper.cs
- FillErrorEventArgs.cs
- WebServiceData.cs
- PropertyManager.cs
- DTCTransactionManager.cs
- SapiRecoInterop.cs
- ApplicationFileCodeDomTreeGenerator.cs
- SettingsProviderCollection.cs
- TreeIterator.cs
- BitmapFrameEncode.cs
- PassportAuthentication.cs
- DesignerDataView.cs
- ExclusiveCanonicalizationTransform.cs
- ServerIdentity.cs
- PartitionResolver.cs
- coordinator.cs
- WindowsNonControl.cs
- Scalars.cs
- UniqueConstraint.cs
- Int64AnimationBase.cs
- DrawingAttributesDefaultValueFactory.cs
- WCFModelStrings.Designer.cs
- PropertyDescriptor.cs
- DataGridViewAutoSizeModeEventArgs.cs
- RequestCache.cs
- OptimizedTemplateContentHelper.cs
- ContainerActivationHelper.cs
- AttachedPropertyMethodSelector.cs
- CompositeFontInfo.cs
- UnhandledExceptionEventArgs.cs
- SqlCacheDependencyDatabase.cs
- FontStretch.cs