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
- IndicFontClient.cs
- _RequestCacheProtocol.cs
- InputBindingCollection.cs
- Geometry.cs
- VScrollProperties.cs
- ConfigurationLockCollection.cs
- MasterPageParser.cs
- BufferManager.cs
- ComponentRenameEvent.cs
- PathSegmentCollection.cs
- SubpageParaClient.cs
- FloatUtil.cs
- Literal.cs
- SingleResultAttribute.cs
- CultureNotFoundException.cs
- HwndTarget.cs
- VirtualPathProvider.cs
- WindowAutomationPeer.cs
- PasswordRecovery.cs
- MethodExpression.cs
- ResXFileRef.cs
- ProviderSettings.cs
- SystemTcpStatistics.cs
- DebugHandleTracker.cs
- Util.cs
- filewebresponse.cs
- HttpWriter.cs
- ProcessInputEventArgs.cs
- DataGridViewRowCollection.cs
- Soap.cs
- MailMessage.cs
- WebPartTransformerAttribute.cs
- EventData.cs
- ServiceAuthorizationBehavior.cs
- ItemContainerProviderWrapper.cs
- NoneExcludedImageIndexConverter.cs
- BypassElementCollection.cs
- DataGridLinkButton.cs
- AppDomain.cs
- CodeExporter.cs
- XmlAttributeProperties.cs
- ConfigErrorGlyph.cs
- infer.cs
- Transform3DCollection.cs
- WebCategoryAttribute.cs
- AsyncResult.cs
- EntityClassGenerator.cs
- Expressions.cs
- ExtentCqlBlock.cs
- isolationinterop.cs
- ChannelSinkStacks.cs
- SqlGenericUtil.cs
- GridEntry.cs
- OleDbTransaction.cs
- UTF8Encoding.cs
- SourceLineInfo.cs
- DataGridViewImageCell.cs
- XhtmlBasicCommandAdapter.cs
- StorageEndPropertyMapping.cs
- MsmqTransportBindingElement.cs
- ObjectDataSourceSelectingEventArgs.cs
- OdbcHandle.cs
- ButtonDesigner.cs
- ModulesEntry.cs
- ChildDocumentBlock.cs
- BrowserCapabilitiesFactory.cs
- DbConnectionPoolGroup.cs
- LocationReferenceEnvironment.cs
- ImageSource.cs
- ImageMap.cs
- TransformationRules.cs
- FilteredDataSetHelper.cs
- QilReference.cs
- SByteConverter.cs
- TimeSpan.cs
- ContextMenuAutomationPeer.cs
- SHA256.cs
- SR.cs
- DataGridParentRows.cs
- Context.cs
- XmlAttributeProperties.cs
- HttpHandler.cs
- SafeBitVector32.cs
- ColumnResult.cs
- RtfControls.cs
- BitStack.cs
- SiteMapDataSourceView.cs
- FillErrorEventArgs.cs
- TraceListener.cs
- TargetParameterCountException.cs
- ByteStream.cs
- ContentFilePart.cs
- StatusBarItemAutomationPeer.cs
- ColumnResizeAdorner.cs
- BufferBuilder.cs
- FontFamily.cs
- MetadataArtifactLoaderXmlReaderWrapper.cs
- TypefaceMap.cs
- DrawingAttributeSerializer.cs
- EventLogTraceListener.cs