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
- CellPartitioner.cs
- XmlSchemaInfo.cs
- EndEvent.cs
- BuildProviderInstallComponent.cs
- SQLGuidStorage.cs
- AstNode.cs
- WebPartConnectionsDisconnectVerb.cs
- xmlglyphRunInfo.cs
- XmlnsCache.cs
- QuotedPrintableStream.cs
- StringComparer.cs
- Internal.cs
- OdbcHandle.cs
- TablePatternIdentifiers.cs
- BoundField.cs
- TypeUsage.cs
- SqlDataSource.cs
- DBConnection.cs
- FileClassifier.cs
- DiagnosticsConfigurationHandler.cs
- ExceptionUtil.cs
- StrokeCollectionDefaultValueFactory.cs
- IisTraceListener.cs
- PropertyGroupDescription.cs
- ConfigXmlElement.cs
- TcpServerChannel.cs
- TextChange.cs
- SoapExtensionTypeElement.cs
- PasswordRecovery.cs
- WebPartTransformer.cs
- SingleSelectRootGridEntry.cs
- XmlCodeExporter.cs
- GradientSpreadMethodValidation.cs
- TrackingStringDictionary.cs
- SerializationUtilities.cs
- NameValueConfigurationElement.cs
- ObjectAnimationBase.cs
- _CacheStreams.cs
- FactorySettingsElement.cs
- messageonlyhwndwrapper.cs
- DesignSurfaceManager.cs
- CodeTypeParameterCollection.cs
- CodeNamespaceImportCollection.cs
- PageTheme.cs
- XsltCompileContext.cs
- RadioButtonStandardAdapter.cs
- AuthorizationSection.cs
- ColorMatrix.cs
- CodeMemberField.cs
- ObjectCloneHelper.cs
- HealthMonitoringSectionHelper.cs
- wmiprovider.cs
- TextSpan.cs
- ToolboxItemSnapLineBehavior.cs
- DataGridViewCellStyleChangedEventArgs.cs
- EntityDescriptor.cs
- EnlistmentTraceIdentifier.cs
- TableLayoutSettingsTypeConverter.cs
- TextViewSelectionProcessor.cs
- WebPartCatalogAddVerb.cs
- DataProviderNameConverter.cs
- HealthMonitoringSectionHelper.cs
- AutoResizedEvent.cs
- PixelShader.cs
- WindowsTokenRoleProvider.cs
- SystemIPAddressInformation.cs
- AttributeQuery.cs
- UxThemeWrapper.cs
- AlphaSortedEnumConverter.cs
- EndPoint.cs
- XmlElement.cs
- input.cs
- ArraySortHelper.cs
- RegexMatchCollection.cs
- SeverityFilter.cs
- ConstructorBuilder.cs
- _LazyAsyncResult.cs
- DynamicEndpointElement.cs
- CallContext.cs
- SvcMapFile.cs
- TraceSection.cs
- ProtocolViolationException.cs
- TcpAppDomainProtocolHandler.cs
- HijriCalendar.cs
- IgnorePropertiesAttribute.cs
- ExternalFile.cs
- PageSettings.cs
- BypassElementCollection.cs
- cookie.cs
- InstalledFontCollection.cs
- SQLInt16Storage.cs
- FreezableCollection.cs
- EdmComplexPropertyAttribute.cs
- SqlDataSourceView.cs
- DBCommandBuilder.cs
- TextRangeEditTables.cs
- BitStack.cs
- ServiceDeploymentInfo.cs
- UriTemplatePathPartiallyEquivalentSet.cs
- WSDualHttpSecurityElement.cs