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
- ArgumentNullException.cs
- Hashtable.cs
- ListComponentEditorPage.cs
- SrgsRule.cs
- Decoder.cs
- PartialCachingAttribute.cs
- BoundColumn.cs
- CompositeCollection.cs
- CompareValidator.cs
- IImplicitResourceProvider.cs
- Point3DKeyFrameCollection.cs
- HttpServerUtilityWrapper.cs
- Int16Storage.cs
- ToolstripProfessionalRenderer.cs
- StreamWriter.cs
- DBAsyncResult.cs
- BindingGroup.cs
- ConnectionManagementSection.cs
- TaiwanCalendar.cs
- DataContractSerializer.cs
- ItemType.cs
- ProvideValueServiceProvider.cs
- SkewTransform.cs
- ConfigurationSchemaErrors.cs
- NoResizeSelectionBorderGlyph.cs
- UnauthorizedWebPart.cs
- CodeValidator.cs
- ToolStripSeparator.cs
- XmlDocument.cs
- StreamMarshaler.cs
- CalendarTable.cs
- TextEditorLists.cs
- AppDomainEvidenceFactory.cs
- ReflectionPermission.cs
- PageStatePersister.cs
- EventSchemaTraceListener.cs
- SineEase.cs
- FocusWithinProperty.cs
- MemoryMappedFileSecurity.cs
- BaseUriHelper.cs
- SRDisplayNameAttribute.cs
- StylusButtonEventArgs.cs
- StoragePropertyMapping.cs
- DesignerLoader.cs
- LinkConverter.cs
- ShapingEngine.cs
- NullReferenceException.cs
- Command.cs
- HttpBindingExtension.cs
- Emitter.cs
- DBConnection.cs
- OleDbPropertySetGuid.cs
- SystemIcons.cs
- QuadraticBezierSegment.cs
- GcHandle.cs
- HttpCookieCollection.cs
- EdmSchemaError.cs
- PropertyCollection.cs
- WebRequestModuleElementCollection.cs
- XmlText.cs
- ServiceContractListItemList.cs
- MultipleViewPattern.cs
- SelectionEditor.cs
- DataGridRowHeaderAutomationPeer.cs
- NodeFunctions.cs
- CurrencyManager.cs
- FloatAverageAggregationOperator.cs
- RepeaterItem.cs
- _ContextAwareResult.cs
- HwndHost.cs
- ToolStripDropDownClosingEventArgs.cs
- SizeLimitedCache.cs
- SchemaMapping.cs
- RowTypeElement.cs
- ReadOnlyKeyedCollection.cs
- ToolStripProfessionalLowResolutionRenderer.cs
- ApplicationManager.cs
- SqlFacetAttribute.cs
- NumericExpr.cs
- baseaxisquery.cs
- SpoolingTaskBase.cs
- UrlPath.cs
- uribuilder.cs
- FrameworkElement.cs
- ReadOnlyCollectionBase.cs
- DataGridViewRowPrePaintEventArgs.cs
- ItemContainerGenerator.cs
- SqlDependencyUtils.cs
- DecoderNLS.cs
- CaseStatementProjectedSlot.cs
- AssemblyBuilder.cs
- WebBrowserPermission.cs
- LoginUtil.cs
- InputLanguageSource.cs
- GenericsInstances.cs
- SecondaryViewProvider.cs
- DesignerActionGlyph.cs
- LinqDataView.cs
- DataGridColumn.cs
- CommandDevice.cs