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
- FixedSOMTableCell.cs
- OutOfProcStateClientManager.cs
- Point3D.cs
- GB18030Encoding.cs
- DataGridViewHitTestInfo.cs
- Utils.cs
- DecoderBestFitFallback.cs
- PageSetupDialog.cs
- FrameworkRichTextComposition.cs
- EventWaitHandle.cs
- TextTreeTextBlock.cs
- ScalarOps.cs
- XmlILAnnotation.cs
- _TimerThread.cs
- smtpconnection.cs
- HtmlAnchor.cs
- XPathAncestorIterator.cs
- DataGridBeginningEditEventArgs.cs
- PathSegment.cs
- TraceContext.cs
- ACL.cs
- BlobPersonalizationState.cs
- ComplexPropertyEntry.cs
- PriorityBindingExpression.cs
- Size3D.cs
- TextInfo.cs
- HttpRequestCacheValidator.cs
- FrameSecurityDescriptor.cs
- ContextMarshalException.cs
- ImageListUtils.cs
- CodeTypeMemberCollection.cs
- XPathPatternParser.cs
- TemplateKey.cs
- SessionPageStateSection.cs
- MultiView.cs
- BaseAddressElement.cs
- XmlName.cs
- OracleConnectionString.cs
- Underline.cs
- HostedAspNetEnvironment.cs
- WebScriptEnablingElement.cs
- ParsedAttributeCollection.cs
- AuthStoreRoleProvider.cs
- ViewLoader.cs
- TableItemStyle.cs
- StreamAsIStream.cs
- HwndProxyElementProvider.cs
- DispatcherTimer.cs
- XmlDataSourceView.cs
- TimeSpan.cs
- TypeCacheManager.cs
- BindingList.cs
- FixedSOMElement.cs
- HttpHandlerAction.cs
- SByte.cs
- CodePageEncoding.cs
- PkcsUtils.cs
- StringResourceManager.cs
- PasswordPropertyTextAttribute.cs
- RenderCapability.cs
- CommentAction.cs
- PersonalizationProviderCollection.cs
- TdsParserStaticMethods.cs
- HostExecutionContextManager.cs
- Brush.cs
- GPRECTF.cs
- DataRelation.cs
- Point.cs
- ToolStripSeparatorRenderEventArgs.cs
- Brush.cs
- LinearGradientBrush.cs
- LinearGradientBrush.cs
- Decoder.cs
- XmlSchemaSet.cs
- MinimizableAttributeTypeConverter.cs
- RequestContextBase.cs
- DataBoundControlDesigner.cs
- PageCodeDomTreeGenerator.cs
- MappingModelBuildProvider.cs
- SharedPersonalizationStateInfo.cs
- MaskedTextBox.cs
- CustomLineCap.cs
- XPathNode.cs
- TransformerInfo.cs
- XmlToDatasetMap.cs
- TemplateBindingExtension.cs
- Assert.cs
- TokenBasedSet.cs
- SecurityManager.cs
- XmlAttributes.cs
- CodeRegionDirective.cs
- FusionWrap.cs
- ConfigurationManager.cs
- SchemaImporterExtensionElement.cs
- ObjectSecurityT.cs
- LabelAutomationPeer.cs
- CqlLexer.cs
- MatrixIndependentAnimationStorage.cs
- WebPartMovingEventArgs.cs
- SpeakCompletedEventArgs.cs