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
- OdbcStatementHandle.cs
- TerminatorSinks.cs
- FactoryId.cs
- DSASignatureFormatter.cs
- SoundPlayerAction.cs
- PlanCompiler.cs
- GetRecipientListRequest.cs
- BitmapEffectDrawing.cs
- HtmlTableCell.cs
- QilChoice.cs
- safex509handles.cs
- CodeRegionDirective.cs
- Attribute.cs
- ItemContainerProviderWrapper.cs
- AttributeCollection.cs
- DataContext.cs
- DataGridRow.cs
- DiscoveryDocument.cs
- ParagraphResult.cs
- RemoteWebConfigurationHostStream.cs
- PropertyEmitterBase.cs
- RemoteWebConfigurationHostServer.cs
- VariableQuery.cs
- KnownTypeHelper.cs
- OverflowException.cs
- DefaultIfEmptyQueryOperator.cs
- HitTestParameters.cs
- URLIdentityPermission.cs
- XmlWhitespace.cs
- PreviewKeyDownEventArgs.cs
- LicenseProviderAttribute.cs
- XPathNodeIterator.cs
- EntityDataSourceWizardForm.cs
- CriticalFileToken.cs
- DataGridViewSelectedCellCollection.cs
- QualifiedCellIdBoolean.cs
- UnsafeNativeMethodsMilCoreApi.cs
- XmlSchemaSimpleContentRestriction.cs
- ControlBindingsConverter.cs
- _emptywebproxy.cs
- UnsafeNativeMethodsMilCoreApi.cs
- MobileControlsSection.cs
- Margins.cs
- CustomAttribute.cs
- DBConnectionString.cs
- DoubleAnimationClockResource.cs
- CatalogZone.cs
- ColumnWidthChangedEvent.cs
- LogicalMethodInfo.cs
- SystemInformation.cs
- _RequestCacheProtocol.cs
- RequestNavigateEventArgs.cs
- XmlDictionaryReader.cs
- AutomationPattern.cs
- ElementsClipboardData.cs
- Tuple.cs
- DataBoundControlAdapter.cs
- VisualStateManager.cs
- Command.cs
- StrokeRenderer.cs
- Bezier.cs
- GB18030Encoding.cs
- SafeSecurityHelper.cs
- ClassData.cs
- TableLayoutColumnStyleCollection.cs
- ListComponentEditor.cs
- CounterCreationDataCollection.cs
- EncryptedPackageFilter.cs
- X509IssuerSerialKeyIdentifierClause.cs
- BuildManagerHost.cs
- PasswordRecovery.cs
- SystemColors.cs
- EnumType.cs
- DataGridClipboardHelper.cs
- initElementDictionary.cs
- CacheVirtualItemsEvent.cs
- ExpressionBindingsDialog.cs
- MembershipPasswordException.cs
- BinaryReader.cs
- CodeObject.cs
- MenuTracker.cs
- Hashtable.cs
- TreeNodeStyle.cs
- BlurBitmapEffect.cs
- PropertyEmitter.cs
- IndentTextWriter.cs
- DockAndAnchorLayout.cs
- PowerEase.cs
- XmlAttributeCache.cs
- NativeRightsManagementAPIsStructures.cs
- ServiceOperation.cs
- AtomServiceDocumentSerializer.cs
- RelationshipSet.cs
- ExeContext.cs
- LinkedList.cs
- Padding.cs
- XmlQueryCardinality.cs
- Point4D.cs
- ExpressionWriter.cs
- SubMenuStyle.cs