Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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. // // ==--== // // 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- WebPartEditorApplyVerb.cs
- ReaderWriterLock.cs
- RowToFieldTransformer.cs
- AutomationElement.cs
- TextParaClient.cs
- ExpressionDumper.cs
- ThumbButtonInfoCollection.cs
- PixelFormat.cs
- GenericWebPart.cs
- TextOutput.cs
- FixedLineResult.cs
- PersonalizationProvider.cs
- FileLogRecordStream.cs
- Vector3DConverter.cs
- _TLSstream.cs
- Menu.cs
- DesignerWithHeader.cs
- KnownBoxes.cs
- BitmapImage.cs
- OpenTypeLayout.cs
- SafeSystemMetrics.cs
- ToolStripItem.cs
- PersonalizablePropertyEntry.cs
- InputScopeNameConverter.cs
- XslAst.cs
- RoutedPropertyChangedEventArgs.cs
- MaskDescriptor.cs
- OracleMonthSpan.cs
- FrameDimension.cs
- Listbox.cs
- DataKeyArray.cs
- CacheSection.cs
- UserControlBuildProvider.cs
- ResourceContainer.cs
- TableHeaderCell.cs
- GCHandleCookieTable.cs
- VarInfo.cs
- SchemaTableColumn.cs
- StringDictionary.cs
- basecomparevalidator.cs
- ByteStreamGeometryContext.cs
- ArraySegment.cs
- StringOutput.cs
- DataRecordInternal.cs
- DeferredBinaryDeserializerExtension.cs
- StringFormat.cs
- FunctionParameter.cs
- HttpModuleAction.cs
- ComplexObject.cs
- IOException.cs
- IProducerConsumerCollection.cs
- IDQuery.cs
- FormViewPageEventArgs.cs
- ProxyWebPart.cs
- ConstraintConverter.cs
- XmlDomTextWriter.cs
- NetSectionGroup.cs
- RefreshPropertiesAttribute.cs
- CodeAttributeDeclarationCollection.cs
- MobileTextWriter.cs
- CompensationTokenData.cs
- OptimalTextSource.cs
- DataTableNameHandler.cs
- RightsManagementUser.cs
- CodeSnippetStatement.cs
- EntitySetBaseCollection.cs
- FontCacheUtil.cs
- OdbcStatementHandle.cs
- ClientScriptManagerWrapper.cs
- ServiceContractViewControl.cs
- AudioException.cs
- GroupByQueryOperator.cs
- CompareValidator.cs
- CompositeScriptReference.cs
- RSAOAEPKeyExchangeFormatter.cs
- AuthenticationModulesSection.cs
- cookie.cs
- UnsafeNativeMethods.cs
- CellTreeNode.cs
- DataStreams.cs
- PropertyMapper.cs
- uribuilder.cs
- ServiceOperationInvoker.cs
- XmlSchemaNotation.cs
- EpmHelper.cs
- XsdCachingReader.cs
- SelectionHighlightInfo.cs
- SecurityPolicySection.cs
- Number.cs
- ConfigXmlElement.cs
- RoleGroup.cs
- StackOverflowException.cs
- LogExtent.cs
- COM2Enum.cs
- MdiWindowListItemConverter.cs
- HttpClientCertificate.cs
- COM2Properties.cs
- Ops.cs
- ModulesEntry.cs
- ProjectionPath.cs