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
- HtmlInputFile.cs
- ToolStripPanel.cs
- XmlChildEnumerator.cs
- CryptoHelper.cs
- SqlBulkCopy.cs
- EntitySqlQueryCacheKey.cs
- SafeBitVector32.cs
- basemetadatamappingvisitor.cs
- XPathAncestorIterator.cs
- PanelStyle.cs
- DateTimeSerializationSection.cs
- DoubleCollectionConverter.cs
- SettingsSavedEventArgs.cs
- DesignOnlyAttribute.cs
- ControlSerializer.cs
- OperationFormatStyle.cs
- GacUtil.cs
- ObjectReferenceStack.cs
- ExceptionValidationRule.cs
- Debugger.cs
- RegisteredDisposeScript.cs
- TimeManager.cs
- CodeGenerator.cs
- SerializationInfoEnumerator.cs
- SortedDictionary.cs
- StringResourceManager.cs
- TaskSchedulerException.cs
- SemaphoreSecurity.cs
- XmlNavigatorFilter.cs
- ReliableInputConnection.cs
- QuadraticEase.cs
- PageResolution.cs
- _NtlmClient.cs
- GenericNameHandler.cs
- KnownBoxes.cs
- CompilerTypeWithParams.cs
- StylesEditorDialog.cs
- TextRangeEdit.cs
- ListItemCollection.cs
- RootBuilder.cs
- UserControl.cs
- SecurityElement.cs
- XmlToDatasetMap.cs
- DbException.cs
- DBSchemaTable.cs
- RedBlackList.cs
- FieldToken.cs
- ByteAnimationUsingKeyFrames.cs
- BackgroundWorker.cs
- BindingManagerDataErrorEventArgs.cs
- XmlQueryStaticData.cs
- PartitionResolver.cs
- ResetableIterator.cs
- WeakRefEnumerator.cs
- DynamicILGenerator.cs
- PageTheme.cs
- OLEDB_Enum.cs
- Utils.cs
- WorkflowMarkupSerializer.cs
- TypeNameConverter.cs
- ParserOptions.cs
- StreamHelper.cs
- DelegateSerializationHolder.cs
- CounterSampleCalculator.cs
- OpenFileDialog.cs
- TypeUtils.cs
- InProcStateClientManager.cs
- ListGeneralPage.cs
- SmtpLoginAuthenticationModule.cs
- SQLDateTime.cs
- Keywords.cs
- safex509handles.cs
- DataGridColumnHeadersPresenterAutomationPeer.cs
- GraphicsPath.cs
- Keywords.cs
- GridViewDeletedEventArgs.cs
- CacheSection.cs
- FreezableDefaultValueFactory.cs
- EncoderReplacementFallback.cs
- RegionIterator.cs
- GcHandle.cs
- CurrentChangingEventArgs.cs
- MexNamedPipeBindingCollectionElement.cs
- HelpInfo.cs
- PropagatorResult.cs
- InheritedPropertyChangedEventArgs.cs
- OrthographicCamera.cs
- UIElementParaClient.cs
- ElementsClipboardData.cs
- NamedPipeChannelFactory.cs
- UnmanagedMarshal.cs
- RpcCryptoRequest.cs
- ChannelServices.cs
- WizardDesigner.cs
- PropertyMetadata.cs
- PrintDialogException.cs
- WorkflowRuntimeServicesBehavior.cs
- DateTimeHelper.cs
- MenuCommandService.cs
- ProcessInfo.cs