Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / 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); } } }
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Formatter.cs
- HtmlForm.cs
- CommentEmitter.cs
- FacetChecker.cs
- UdpDiscoveryEndpointProvider.cs
- Normalizer.cs
- DiagnosticsConfigurationHandler.cs
- PrinterUnitConvert.cs
- RefreshEventArgs.cs
- XmlSchemaComplexContentExtension.cs
- HttpModuleActionCollection.cs
- SqlInfoMessageEvent.cs
- ExceptionHandlersDesigner.cs
- HandlerWithFactory.cs
- ClientBuildManager.cs
- MethodBuilderInstantiation.cs
- ObservableCollection.cs
- TableLayoutColumnStyleCollection.cs
- ImageDrawing.cs
- TypeTypeConverter.cs
- PrivilegeNotHeldException.cs
- WorkflowPrinting.cs
- AnnotationComponentChooser.cs
- Vector3DAnimationUsingKeyFrames.cs
- KeyedCollection.cs
- ListenerSingletonConnectionReader.cs
- GeometryHitTestParameters.cs
- DataGridCaption.cs
- AssertFilter.cs
- InputManager.cs
- DeploymentExceptionMapper.cs
- DataBinder.cs
- PatternMatcher.cs
- GraphicsState.cs
- ToolStripSystemRenderer.cs
- SqlRewriteScalarSubqueries.cs
- thaishape.cs
- DecoderExceptionFallback.cs
- ObjectListDesigner.cs
- DrawingContextWalker.cs
- Assembly.cs
- HeaderPanel.cs
- UserInitiatedRoutedEventPermissionAttribute.cs
- SystemIPAddressInformation.cs
- TextTreeDeleteContentUndoUnit.cs
- BrowserDefinitionCollection.cs
- Privilege.cs
- BaseResourcesBuildProvider.cs
- Deflater.cs
- ImageAnimator.cs
- InfoCardTraceRecord.cs
- DBSqlParserColumn.cs
- MonthChangedEventArgs.cs
- SQLByteStorage.cs
- Separator.cs
- DBConnectionString.cs
- Expression.cs
- invalidudtexception.cs
- InputBuffer.cs
- DataBindEngine.cs
- SelectedDatesCollection.cs
- PropertyRecord.cs
- ObfuscationAttribute.cs
- BezierSegment.cs
- DeobfuscatingStream.cs
- ApplicationDirectory.cs
- DateTimeConverter2.cs
- PngBitmapEncoder.cs
- WbemException.cs
- CellLabel.cs
- EntityDataSourceReferenceGroup.cs
- DeleteIndexBinder.cs
- TableItemStyle.cs
- SqlDeflator.cs
- UnsafeNativeMethods.cs
- EnumConverter.cs
- ContactManager.cs
- AsynchronousChannelMergeEnumerator.cs
- SystemThemeKey.cs
- ButtonStandardAdapter.cs
- SqlRowUpdatingEvent.cs
- HttpCapabilitiesBase.cs
- ContainerParaClient.cs
- UpDownEvent.cs
- MarkupCompiler.cs
- CapabilitiesState.cs
- CounterCreationDataCollection.cs
- GregorianCalendarHelper.cs
- LoadedOrUnloadedOperation.cs
- DbConnectionClosed.cs
- Hash.cs
- PermissionSetTriple.cs
- ThreadExceptionEvent.cs
- XhtmlBasicTextViewAdapter.cs
- ClassValidator.cs
- ProtocolsSection.cs
- SingleSelectRootGridEntry.cs
- CommandDevice.cs
- EncoderNLS.cs
- ListBindingHelper.cs