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
- WebServicesDescriptionAttribute.cs
- ExpressionCopier.cs
- ConfigurationValidatorBase.cs
- cookiecollection.cs
- MatrixConverter.cs
- SortDescriptionCollection.cs
- DesignerSerializationVisibilityAttribute.cs
- ScriptingScriptResourceHandlerSection.cs
- PointCollectionValueSerializer.cs
- XamlClipboardData.cs
- OutputScope.cs
- ImplicitInputBrush.cs
- DataServiceResponse.cs
- EnumBuilder.cs
- _AutoWebProxyScriptEngine.cs
- X509Certificate2.cs
- IndexedWhereQueryOperator.cs
- MimeTypeMapper.cs
- DebugView.cs
- ApplicationGesture.cs
- XmlSchemaFacet.cs
- CacheAxisQuery.cs
- MessagePartDescription.cs
- XmlSchemaComplexType.cs
- DataRelation.cs
- FixedTextBuilder.cs
- SqlRowUpdatedEvent.cs
- HttpInputStream.cs
- CommandBindingCollection.cs
- DateTimeValueSerializerContext.cs
- BitmapCodecInfo.cs
- BindingManagerDataErrorEventArgs.cs
- TextFindEngine.cs
- DeclarativeConditionsCollection.cs
- PathSegmentCollection.cs
- WindowsListViewItemCheckBox.cs
- CollaborationHelperFunctions.cs
- CapabilitiesUse.cs
- Ipv6Element.cs
- ChameleonKey.cs
- XmlAttributeOverrides.cs
- RemoteWebConfigurationHostServer.cs
- ValidatedControlConverter.cs
- PointLight.cs
- DropAnimation.xaml.cs
- AuthenticationSection.cs
- DataGridViewCheckBoxColumn.cs
- WebServicesInteroperability.cs
- EdmConstants.cs
- Bold.cs
- PropertyGridDesigner.cs
- TTSEvent.cs
- RoleService.cs
- Int32Converter.cs
- InstancePersistenceException.cs
- PermissionAttributes.cs
- HtmlUtf8RawTextWriter.cs
- SynchronizedPool.cs
- OdbcDataReader.cs
- PropertiesTab.cs
- Table.cs
- ConfigurationStrings.cs
- ToolStripActionList.cs
- ContourSegment.cs
- ObjectContext.cs
- ProxyBuilder.cs
- PointConverter.cs
- CatalogZoneBase.cs
- XmlWellformedWriter.cs
- IisNotInstalledException.cs
- MemberDescriptor.cs
- DesignerVerb.cs
- ResXDataNode.cs
- SystemIcmpV6Statistics.cs
- PageEventArgs.cs
- FontUnit.cs
- OleDbRowUpdatedEvent.cs
- MobileUserControl.cs
- DataListItemEventArgs.cs
- TextRangeProviderWrapper.cs
- InternalConfigEventArgs.cs
- HtmlEmptyTagControlBuilder.cs
- ProcessHostServerConfig.cs
- ComplexObject.cs
- CorrelationTokenInvalidatedHandler.cs
- TextEffectCollection.cs
- RadialGradientBrush.cs
- SymmetricAlgorithm.cs
- ParameterElementCollection.cs
- CannotUnloadAppDomainException.cs
- MemberAssignment.cs
- WindowsPen.cs
- AssemblyCacheEntry.cs
- IisTraceListener.cs
- SecurityDocument.cs
- PageBuildProvider.cs
- ValidateNames.cs
- RuleSettingsCollection.cs
- UriSchemeKeyedCollection.cs
- MetadataElement.cs