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
- IntranetCredentialPolicy.cs
- StorageEndPropertyMapping.cs
- Permission.cs
- QilNode.cs
- TableAdapterManagerMethodGenerator.cs
- InlineObject.cs
- RsaKeyIdentifierClause.cs
- UserControlBuildProvider.cs
- RuntimeVariableList.cs
- CheckPair.cs
- PageSettings.cs
- VisualStyleRenderer.cs
- Drawing.cs
- ProcessHostMapPath.cs
- EventWaitHandle.cs
- MenuItemCollection.cs
- XsdDuration.cs
- StackBuilderSink.cs
- CompilerErrorCollection.cs
- OracleTimeSpan.cs
- Deflater.cs
- TextEditorCharacters.cs
- DelegateBodyWriter.cs
- Int64AnimationUsingKeyFrames.cs
- SiteMapPath.cs
- NullRuntimeConfig.cs
- TableLayoutColumnStyleCollection.cs
- ToolStripContainer.cs
- ClusterSafeNativeMethods.cs
- GroupQuery.cs
- ContainerControl.cs
- Debug.cs
- Renderer.cs
- NotifyInputEventArgs.cs
- SecurityCookieModeValidator.cs
- FormView.cs
- TdsParserSessionPool.cs
- DataGridViewCellValidatingEventArgs.cs
- RegexParser.cs
- BindingManagerDataErrorEventArgs.cs
- Delegate.cs
- InkPresenterAutomationPeer.cs
- Publisher.cs
- BamlTreeNode.cs
- DetailsViewInsertEventArgs.cs
- EdmComplexTypeAttribute.cs
- XmlWriterSettings.cs
- DetailsViewCommandEventArgs.cs
- UIElement3D.cs
- ISessionStateStore.cs
- BuildProvider.cs
- TimeManager.cs
- SqlException.cs
- QilFactory.cs
- GenericEnumConverter.cs
- GrammarBuilderPhrase.cs
- WhiteSpaceTrimStringConverter.cs
- CommandID.cs
- AuthenticationConfig.cs
- Binding.cs
- WindowsMenu.cs
- XslTransformFileEditor.cs
- ModelProperty.cs
- Sql8ConformanceChecker.cs
- Gdiplus.cs
- AlignmentYValidation.cs
- HostingEnvironment.cs
- ellipse.cs
- DataGridViewControlCollection.cs
- XPathNavigator.cs
- FilterableData.cs
- SoapServerMessage.cs
- CheckBoxField.cs
- Message.cs
- PageParserFilter.cs
- ReadOnlyCollectionBase.cs
- ColorConverter.cs
- WrappedDispatcherException.cs
- SettingsAttributeDictionary.cs
- ShapeTypeface.cs
- QilVisitor.cs
- HttpCacheVaryByContentEncodings.cs
- OleDbCommandBuilder.cs
- SQLMoney.cs
- DataControlCommands.cs
- CompositeFontInfo.cs
- SizeConverter.cs
- MarkupObject.cs
- ScalarRestriction.cs
- SvcMapFileLoader.cs
- BooleanSwitch.cs
- ConfigurationSectionGroup.cs
- CopyNodeSetAction.cs
- versioninfo.cs
- CssTextWriter.cs
- SQLDecimalStorage.cs
- SystemWebCachingSectionGroup.cs
- Tablet.cs
- BinaryNode.cs
- SmiEventSink_DeferedProcessing.cs