Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / 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); } } }
Link Menu
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- AssociatedControlConverter.cs
- DynamicObjectAccessor.cs
- LinkConverter.cs
- LassoSelectionBehavior.cs
- SHA512Cng.cs
- SAPICategories.cs
- UIElementPropertyUndoUnit.cs
- PolicyLevel.cs
- Number.cs
- SecureConversationVersion.cs
- documentation.cs
- OpenTypeCommon.cs
- Binding.cs
- XamlWrappingReader.cs
- DesignParameter.cs
- VSWCFServiceContractGenerator.cs
- ExclusiveTcpTransportManager.cs
- MenuBase.cs
- ControlUtil.cs
- CodePropertyReferenceExpression.cs
- dataprotectionpermission.cs
- ObjectMemberMapping.cs
- TriggerAction.cs
- GenericUriParser.cs
- WindowsGraphics2.cs
- EventWaitHandleSecurity.cs
- SignatureResourcePool.cs
- DateTimeHelper.cs
- SafeCertificateStore.cs
- XmlDataSourceDesigner.cs
- ColorIndependentAnimationStorage.cs
- XmlSchemaSimpleContentRestriction.cs
- ImageProxy.cs
- BooleanStorage.cs
- TextElement.cs
- SettingsPropertyNotFoundException.cs
- Label.cs
- Button.cs
- ClientProxyGenerator.cs
- XmlSignificantWhitespace.cs
- HijriCalendar.cs
- ErrorProvider.cs
- HttpModulesSection.cs
- SqlNode.cs
- StringStorage.cs
- TreeNodeBindingDepthConverter.cs
- SortableBindingList.cs
- DigestTraceRecordHelper.cs
- DockProviderWrapper.cs
- DefaultSerializationProviderAttribute.cs
- KeyNameIdentifierClause.cs
- FragmentQueryKB.cs
- PropertyFilterAttribute.cs
- AnimationClockResource.cs
- Parser.cs
- GenericWebPart.cs
- Condition.cs
- AlignmentXValidation.cs
- NameValuePair.cs
- WebPartConnectionsConfigureVerb.cs
- AppearanceEditorPart.cs
- HttpProxyTransportBindingElement.cs
- EmbeddedMailObject.cs
- recordstate.cs
- XmlHelper.cs
- UserNamePasswordClientCredential.cs
- DrawListViewColumnHeaderEventArgs.cs
- CellLabel.cs
- WindowAutomationPeer.cs
- NetworkInformationException.cs
- ChooseAction.cs
- WebRequestModuleElementCollection.cs
- HttpConfigurationSystem.cs
- FixedStringLookup.cs
- StrokeDescriptor.cs
- EllipticalNodeOperations.cs
- ActivityCodeDomSerializer.cs
- ZoneIdentityPermission.cs
- DataTablePropertyDescriptor.cs
- ProfessionalColorTable.cs
- NavigatorInput.cs
- DesignTimeHTMLTextWriter.cs
- ServiceOperationHelpers.cs
- RowToParametersTransformer.cs
- MethodBuilder.cs
- RegexCapture.cs
- DbMetaDataColumnNames.cs
- SettingsProperty.cs
- DropDownList.cs
- ModelPerspective.cs
- UpDownEvent.cs
- dataSvcMapFileLoader.cs
- TimeSpan.cs
- LineProperties.cs
- safelinkcollection.cs
- bindurihelper.cs
- ChangeConflicts.cs
- WindowShowOrOpenTracker.cs
- XmlLinkedNode.cs
- XamlParser.cs