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
- SystemIPv4InterfaceProperties.cs
- Brushes.cs
- PermissionSetTriple.cs
- XmlComment.cs
- DBBindings.cs
- EntitySetBase.cs
- TemplateLookupAction.cs
- XmlStringTable.cs
- OverlappedAsyncResult.cs
- SymbolEqualComparer.cs
- CustomExpressionEventArgs.cs
- LineServices.cs
- ColumnHeaderConverter.cs
- SQLDateTime.cs
- Matrix3D.cs
- GACIdentityPermission.cs
- ThrowHelper.cs
- XmlAutoDetectWriter.cs
- DeclaredTypeElementCollection.cs
- QueryStatement.cs
- hresults.cs
- DataServiceException.cs
- EndpointReference.cs
- Point3DAnimation.cs
- HitTestParameters.cs
- LogLogRecordEnumerator.cs
- AnimationLayer.cs
- _AcceptOverlappedAsyncResult.cs
- JsonFormatReaderGenerator.cs
- DescendantQuery.cs
- Win32MouseDevice.cs
- __TransparentProxy.cs
- WebServiceMethodData.cs
- XmlCountingReader.cs
- SelectionBorderGlyph.cs
- XmlSchemaIdentityConstraint.cs
- DefaultCommandConverter.cs
- Flattener.cs
- IgnorePropertiesAttribute.cs
- SchemaImporterExtensionsSection.cs
- XmlNodeChangedEventManager.cs
- GregorianCalendar.cs
- AccessDataSourceView.cs
- CatalogZoneBase.cs
- BitmapCache.cs
- RemotingAttributes.cs
- DataBindingExpressionBuilder.cs
- BitmapImage.cs
- RemotingConfiguration.cs
- DocumentXPathNavigator.cs
- SQLDecimal.cs
- ISFClipboardData.cs
- DataGridViewRowErrorTextNeededEventArgs.cs
- ToolStripContainer.cs
- ReflectionTypeLoadException.cs
- PropertyInformation.cs
- AttachedPropertiesService.cs
- ConnectorMovedEventArgs.cs
- DbConnectionStringBuilder.cs
- GeneralTransform3DGroup.cs
- XmlText.cs
- TextShapeableCharacters.cs
- AuthenticationManager.cs
- RelatedCurrencyManager.cs
- TypeSystem.cs
- ServicePoint.cs
- ClientConfigPaths.cs
- SoapObjectWriter.cs
- HtmlTableRowCollection.cs
- RelationshipConstraintValidator.cs
- xmlsaver.cs
- NotificationContext.cs
- MenuItemBinding.cs
- DocumentSchemaValidator.cs
- NamespaceList.cs
- PropertyIDSet.cs
- VersionedStreamOwner.cs
- recordstate.cs
- TranslateTransform3D.cs
- DataGridViewRowConverter.cs
- UndoEngine.cs
- X509Certificate2Collection.cs
- MsmqProcessProtocolHandler.cs
- TableLayoutPanelBehavior.cs
- XmlSchemaComplexContentExtension.cs
- MatrixKeyFrameCollection.cs
- FlowLayout.cs
- FloaterParaClient.cs
- LogLogRecord.cs
- OleDbSchemaGuid.cs
- PropertyEmitter.cs
- NativeCompoundFileAPIs.cs
- DataGridViewCheckBoxCell.cs
- NodeCounter.cs
- PresentationTraceSources.cs
- DataSvcMapFileSerializer.cs
- CheckBoxList.cs
- AuthenticationServiceManager.cs
- Win32.cs
- StorageComplexTypeMapping.cs