Code:
/ DotNET / DotNET / 8.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

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- IIS7WorkerRequest.cs
- WebScriptEndpointElement.cs
- PerfCounterSection.cs
- ISFClipboardData.cs
- ClientSettingsSection.cs
- XmlNodeChangedEventManager.cs
- ClaimSet.cs
- ArrangedElement.cs
- InstanceLockedException.cs
- EndpointPerformanceCounters.cs
- ControlValuePropertyAttribute.cs
- CodeTypeOfExpression.cs
- ChildChangedEventArgs.cs
- DebugViewWriter.cs
- DrawingContext.cs
- oledbmetadatacollectionnames.cs
- SqlBuilder.cs
- SecurityTokenSpecification.cs
- PlainXmlSerializer.cs
- ClassGenerator.cs
- SignatureSummaryDialog.cs
- DataBoundControl.cs
- ParseElementCollection.cs
- HtmlGenericControl.cs
- AsyncCompletedEventArgs.cs
- RecordBuilder.cs
- PasswordPropertyTextAttribute.cs
- DropShadowEffect.cs
- WindowsListViewScroll.cs
- XmlObjectSerializerWriteContext.cs
- LambdaCompiler.Generated.cs
- PersonalizableTypeEntry.cs
- SqlMetaData.cs
- CallbackException.cs
- ConnectivityStatus.cs
- RoleService.cs
- ExtendedPropertyInfo.cs
- AtomMaterializer.cs
- EventRoute.cs
- RecognizedAudio.cs
- MethodBuilder.cs
- RegexFCD.cs
- AuthorizationSection.cs
- Cursor.cs
- BamlReader.cs
- EnumMemberAttribute.cs
- EUCJPEncoding.cs
- MachineKeyConverter.cs
- InfoCardRSACryptoProvider.cs
- ServiceOperationHelpers.cs
- JoinSymbol.cs
- ScrollBarRenderer.cs
- MemoryPressure.cs
- Win32MouseDevice.cs
- ArrayList.cs
- ConfigurationStrings.cs
- RefreshPropertiesAttribute.cs
- Rect3D.cs
- ObjectSelectorEditor.cs
- BasicViewGenerator.cs
- HitTestDrawingContextWalker.cs
- BindableTemplateBuilder.cs
- SafeLocalAllocation.cs
- FontUnitConverter.cs
- NativeObjectSecurity.cs
- AutoGeneratedField.cs
- XmlSchemaException.cs
- IItemProperties.cs
- coordinatorscratchpad.cs
- SourceInterpreter.cs
- TextCompositionManager.cs
- CancellationHandler.cs
- ParseElement.cs
- EmptyEnumerator.cs
- DataServiceBuildProvider.cs
- DllNotFoundException.cs
- LogArchiveSnapshot.cs
- KeyPressEvent.cs
- SHA1.cs
- Header.cs
- TextPenaltyModule.cs
- Visitor.cs
- XmlSchemaSimpleType.cs
- safemediahandle.cs
- DrawingContextWalker.cs
- SqlBuilder.cs
- ImageUrlEditor.cs
- COM2Enum.cs
- TextEvent.cs
- FixedPageStructure.cs
- ScrollChrome.cs
- SHA512.cs
- MailDefinition.cs
- Container.cs
- ExtentKey.cs
- Executor.cs
- Color.cs
- DataBindingHandlerAttribute.cs
- ImageCodecInfo.cs
- WindowsToolbarItemAsMenuItem.cs