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
- EventMetadata.cs
- MemberMaps.cs
- SynchronizationFilter.cs
- CacheRequest.cs
- OleDbParameter.cs
- SqlUserDefinedTypeAttribute.cs
- Viewport2DVisual3D.cs
- AppLevelCompilationSectionCache.cs
- ApplicationSecurityManager.cs
- ServiceEndpointCollection.cs
- ParserOptions.cs
- CheckedPointers.cs
- XmlUrlResolver.cs
- TdsParserSafeHandles.cs
- Ops.cs
- DeclarativeCatalogPart.cs
- MembershipPasswordException.cs
- KnownTypeHelper.cs
- ClaimTypeRequirement.cs
- SqlPersistenceProviderFactory.cs
- OrthographicCamera.cs
- AuthenticationService.cs
- SequentialActivityDesigner.cs
- FormViewInsertEventArgs.cs
- IntPtr.cs
- LineUtil.cs
- WindowsTokenRoleProvider.cs
- InstalledVoice.cs
- SequentialOutput.cs
- Int32Rect.cs
- TraceFilter.cs
- OutputCacheSettingsSection.cs
- DataObjectAttribute.cs
- WindowsListViewScroll.cs
- Util.cs
- BinaryWriter.cs
- Dump.cs
- PageSettings.cs
- DescendentsWalker.cs
- Pkcs7Signer.cs
- XmlChildNodes.cs
- OrderingInfo.cs
- DependencyPropertyKey.cs
- StringArrayConverter.cs
- HtmlButton.cs
- IIS7WorkerRequest.cs
- ColumnCollection.cs
- FactoryMaker.cs
- TaskScheduler.cs
- IndexedWhereQueryOperator.cs
- DrawingAttributesDefaultValueFactory.cs
- XmlDocumentSchema.cs
- ExpandedWrapper.cs
- XmlDataSourceView.cs
- SoapInteropTypes.cs
- MultipleCopiesCollection.cs
- SafeRightsManagementPubHandle.cs
- DesignerDataTableBase.cs
- TemplateBaseAction.cs
- DataStreamFromComStream.cs
- CachedResourceDictionaryExtension.cs
- ConnectionPoint.cs
- VerticalAlignConverter.cs
- SqlNamer.cs
- CodeAttachEventStatement.cs
- CompositionAdorner.cs
- BrowsableAttribute.cs
- TypeToken.cs
- ProtocolsSection.cs
- XamlValidatingReader.cs
- ProcessHostServerConfig.cs
- DragCompletedEventArgs.cs
- ReservationCollection.cs
- SmtpNetworkElement.cs
- GuidelineSet.cs
- UnmanagedMemoryStream.cs
- WindowAutomationPeer.cs
- RightsManagementPermission.cs
- DefaultValueTypeConverter.cs
- DataExpression.cs
- PassportIdentity.cs
- BooleanStorage.cs
- DynamicILGenerator.cs
- XmlLanguage.cs
- UniqueIdentifierService.cs
- WindowProviderWrapper.cs
- ToolBarButton.cs
- GlyphCollection.cs
- AppLevelCompilationSectionCache.cs
- Vector3DCollection.cs
- JumpPath.cs
- XmlSchemaSubstitutionGroup.cs
- XmlDataSourceView.cs
- ResourceType.cs
- MsdtcClusterUtils.cs
- SoapWriter.cs
- AllMembershipCondition.cs
- ResourceReader.cs
- DbConnectionHelper.cs
- Bitmap.cs