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
- TextBox.cs
- CatalogPartCollection.cs
- ArcSegment.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- OleDbCommandBuilder.cs
- DoubleStorage.cs
- AssemblyResolver.cs
- SoapConverter.cs
- CodeAttachEventStatement.cs
- EditableTreeList.cs
- ContentElement.cs
- TraceUtils.cs
- RectangleF.cs
- StylusCaptureWithinProperty.cs
- TagPrefixCollection.cs
- SpellerError.cs
- XmlDocumentType.cs
- XmlSerializerVersionAttribute.cs
- SecurityTokenSerializer.cs
- HandledMouseEvent.cs
- RadioButtonStandardAdapter.cs
- ISAPIApplicationHost.cs
- DataControlFieldCell.cs
- PreviewPageInfo.cs
- TableCell.cs
- RequestSecurityToken.cs
- PackWebResponse.cs
- PasswordDeriveBytes.cs
- WebPartMovingEventArgs.cs
- TextTabProperties.cs
- CompiledXpathExpr.cs
- ContextMarshalException.cs
- SettingsPropertyIsReadOnlyException.cs
- ArrayList.cs
- DropShadowEffect.cs
- DeriveBytes.cs
- DataFormats.cs
- DataControlFieldCell.cs
- StringUtil.cs
- AnchorEditor.cs
- TrackBar.cs
- SafeMILHandle.cs
- BamlVersionHeader.cs
- TaskDesigner.cs
- AttributeEmitter.cs
- CultureInfoConverter.cs
- ColumnResult.cs
- ObjectStorage.cs
- SignatureDescription.cs
- XmlResolver.cs
- WebPartsSection.cs
- UIAgentMonitorHandle.cs
- HtmlHistory.cs
- DrawListViewSubItemEventArgs.cs
- UriTemplateClientFormatter.cs
- DiscardableAttribute.cs
- AppDomainAttributes.cs
- SystemIPv6InterfaceProperties.cs
- SynchronizedPool.cs
- ReferenceEqualityComparer.cs
- PreparingEnlistment.cs
- VectorCollectionConverter.cs
- XmlAnyAttributeAttribute.cs
- NamespaceDisplay.xaml.cs
- DynamicDiscoveryDocument.cs
- SettingsAttributes.cs
- DrawingGroup.cs
- TogglePatternIdentifiers.cs
- CodeNamespaceCollection.cs
- PTConverter.cs
- ByteViewer.cs
- CodeMemberField.cs
- querybuilder.cs
- DialogWindow.cs
- TypedDataSetSchemaImporterExtension.cs
- SafeLibraryHandle.cs
- PenThread.cs
- WebControlParameterProxy.cs
- DirtyTextRange.cs
- ToolStripItemClickedEventArgs.cs
- PersonalizableTypeEntry.cs
- GPStream.cs
- ValidationSummary.cs
- AppDomainAttributes.cs
- DefaultMergeHelper.cs
- Message.cs
- SrgsSubset.cs
- ControlSerializer.cs
- ListViewDeleteEventArgs.cs
- SortedList.cs
- Page.cs
- EndSelectCardRequest.cs
- DataGridViewSortCompareEventArgs.cs
- VirtualDirectoryMapping.cs
- ContainerParaClient.cs
- UserControl.cs
- Line.cs
- SqlSupersetValidator.cs
- ItemMap.cs
- DefaultProxySection.cs