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
- ChildrenQuery.cs
- BufferAllocator.cs
- Convert.cs
- GeometryConverter.cs
- Point4D.cs
- RecordConverter.cs
- SettingsPropertyValue.cs
- Content.cs
- XmlNavigatorStack.cs
- odbcmetadatafactory.cs
- OleDbPermission.cs
- HttpResponseHeader.cs
- NetworkCredential.cs
- BasicKeyConstraint.cs
- MeasureItemEvent.cs
- UnionCodeGroup.cs
- CodeExpressionStatement.cs
- MaterializeFromAtom.cs
- TcpHostedTransportConfiguration.cs
- MsmqChannelListenerBase.cs
- MapPathBasedVirtualPathProvider.cs
- QueryResponse.cs
- basenumberconverter.cs
- control.ime.cs
- DataSourceCache.cs
- DataGridCaption.cs
- BitConverter.cs
- RoleManagerSection.cs
- WSHttpBinding.cs
- FacetValueContainer.cs
- TableRow.cs
- ContextStack.cs
- HyperLinkColumn.cs
- XmlSerializer.cs
- TemplateField.cs
- MultipartIdentifier.cs
- MemberHolder.cs
- InputLangChangeEvent.cs
- SystemInfo.cs
- ElementUtil.cs
- SvcMapFileSerializer.cs
- KeyValueSerializer.cs
- XamlInt32CollectionSerializer.cs
- UnmanagedMemoryStreamWrapper.cs
- ButtonDesigner.cs
- URLBuilder.cs
- GradientStopCollection.cs
- XmlQueryCardinality.cs
- IntSecurity.cs
- Stylus.cs
- DataGridViewRowsAddedEventArgs.cs
- ZipFileInfo.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- DataTableReaderListener.cs
- OdbcConnectionString.cs
- DataGridViewToolTip.cs
- IPipelineRuntime.cs
- Missing.cs
- ToolStripDropTargetManager.cs
- bindurihelper.cs
- PersistencePipeline.cs
- Avt.cs
- DataGridViewCellToolTipTextNeededEventArgs.cs
- ContentElement.cs
- PaperSource.cs
- ResourceExpressionBuilder.cs
- MultiSelector.cs
- CodeAttributeDeclaration.cs
- _SpnDictionary.cs
- FreezableCollection.cs
- util.cs
- XmlEncodedRawTextWriter.cs
- Double.cs
- MatrixCamera.cs
- Label.cs
- SaveFileDialog.cs
- UnmanagedMemoryStreamWrapper.cs
- SoapElementAttribute.cs
- ConnectionConsumerAttribute.cs
- CngAlgorithmGroup.cs
- NavigatorOutput.cs
- VoiceObjectToken.cs
- SynchronizedInputPattern.cs
- TextTreeDeleteContentUndoUnit.cs
- AttributeConverter.cs
- CodePageEncoding.cs
- CaseInsensitiveHashCodeProvider.cs
- ExpressionEditor.cs
- RadialGradientBrush.cs
- ForeignKeyConstraint.cs
- WindowProviderWrapper.cs
- StartUpEventArgs.cs
- XhtmlBasicLinkAdapter.cs
- Odbc32.cs
- ListView.cs
- ScalarType.cs
- IntSecurity.cs
- SafeArrayTypeMismatchException.cs
- AutoCompleteStringCollection.cs
- OdbcDataReader.cs