Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / ndp / clr / src / BCL / System / Security / Cryptography / RC2.cs / 1 / RC2.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== // // RC2.cs // namespace System.Security.Cryptography { [System.Runtime.InteropServices.ComVisible(true)] public abstract class RC2 : SymmetricAlgorithm { protected int EffectiveKeySizeValue; private static KeySizes[] s_legalBlockSizes = { new KeySizes(64, 64, 0) }; private static KeySizes[] s_legalKeySizes = { new KeySizes(40, 1024, 8) // 1024 bits is theoretical max according to the RFC }; // // protected constructors // protected RC2() { KeySizeValue = 128; BlockSizeValue = 64; FeedbackSizeValue = BlockSizeValue; LegalBlockSizesValue = s_legalBlockSizes; LegalKeySizesValue = s_legalKeySizes; } // // public properties // public virtual int EffectiveKeySize { get { if (EffectiveKeySizeValue == 0) return KeySizeValue; return EffectiveKeySizeValue; } set { if (value > KeySizeValue) { throw new CryptographicException(Environment.GetResourceString("Cryptography_RC2_EKSKS")); } else if (value == 0) { EffectiveKeySizeValue = value; } else if (value < 40) { throw new CryptographicException(Environment.GetResourceString("Cryptography_RC2_EKS40")); } else { if (ValidKeySize(value)) EffectiveKeySizeValue = value; else throw new CryptographicException(Environment.GetResourceString("Cryptography_InvalidKeySize")); } } } public override int KeySize { get { return KeySizeValue; } set { if (value < EffectiveKeySizeValue) throw new CryptographicException(Environment.GetResourceString("Cryptography_RC2_EKSKS")); base.KeySize = value; } } // // public methods // new static public RC2 Create() { return Create("System.Security.Cryptography.RC2"); } new static public RC2 Create(String AlgName) { return (RC2) CryptoConfig.CreateFromName(AlgName); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TokenBasedSetEnumerator.cs
- DataGridViewColumnDividerDoubleClickEventArgs.cs
- PropertyPathConverter.cs
- UseLicense.cs
- TreeIterators.cs
- FacetValues.cs
- serverconfig.cs
- SQLInt32Storage.cs
- EllipseGeometry.cs
- ReadOnlyNameValueCollection.cs
- LinqDataSourceView.cs
- PropertyInformation.cs
- AndCondition.cs
- MethodBuilderInstantiation.cs
- CancelEventArgs.cs
- _AcceptOverlappedAsyncResult.cs
- RestHandlerFactory.cs
- ImageButton.cs
- ReversePositionQuery.cs
- StringToken.cs
- SerializationBinder.cs
- DocumentPaginator.cs
- _DomainName.cs
- HtmlGenericControl.cs
- RequestStatusBarUpdateEventArgs.cs
- ClassicBorderDecorator.cs
- unsafeIndexingFilterStream.cs
- XomlCompiler.cs
- Int32KeyFrameCollection.cs
- TimeSpanStorage.cs
- InternalControlCollection.cs
- SetStoryboardSpeedRatio.cs
- DataGridToolTip.cs
- OrthographicCamera.cs
- MultiPageTextView.cs
- ClientFactory.cs
- ClientBuildManagerTypeDescriptionProviderBridge.cs
- SID.cs
- Timeline.cs
- ConfigurationSection.cs
- ResourceProperty.cs
- VolatileEnlistmentState.cs
- TdsEnums.cs
- KeyInstance.cs
- ProtocolsConfigurationHandler.cs
- ManipulationPivot.cs
- DSACryptoServiceProvider.cs
- ToolStripSplitStackLayout.cs
- GeneratedCodeAttribute.cs
- SecurityDescriptor.cs
- QilPatternFactory.cs
- sqlpipe.cs
- Lease.cs
- FixedMaxHeap.cs
- XmlCDATASection.cs
- DataGridViewButtonCell.cs
- Predicate.cs
- LabelAutomationPeer.cs
- GPRECT.cs
- MimeParameterWriter.cs
- Regex.cs
- WindowsComboBox.cs
- AggregateException.cs
- CFStream.cs
- DataPointer.cs
- PersonalizationProvider.cs
- ObjectResult.cs
- DBProviderConfigurationHandler.cs
- ListViewInsertEventArgs.cs
- QilReplaceVisitor.cs
- NamespaceEmitter.cs
- DynamicMetaObjectBinder.cs
- SocketInformation.cs
- DataTrigger.cs
- SetIterators.cs
- ResourceAttributes.cs
- MdImport.cs
- SchemaTypeEmitter.cs
- TransactionFlowElement.cs
- MemberAccessException.cs
- XmlWriter.cs
- UnknownBitmapEncoder.cs
- RuleSettings.cs
- SqlInfoMessageEvent.cs
- ToolStripButton.cs
- ApplicationFileParser.cs
- _SecureChannel.cs
- ImageSourceConverter.cs
- Math.cs
- XsltLoader.cs
- TypeDescriptor.cs
- CodeDomDesignerLoader.cs
- LabelLiteral.cs
- Model3D.cs
- PassportAuthentication.cs
- SettingsAttributes.cs
- Resources.Designer.cs
- ServiceOperation.cs
- X509Certificate.cs
- ScrollBar.cs