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
- PropertySet.cs
- ReaderWriterLock.cs
- DataGridBoundColumn.cs
- ISFClipboardData.cs
- DocumentReference.cs
- SchemaImporterExtension.cs
- UserNameSecurityTokenAuthenticator.cs
- RelatedCurrencyManager.cs
- StateRuntime.cs
- InputLanguageProfileNotifySink.cs
- ProviderBase.cs
- Point3DConverter.cs
- XmlSchemaSimpleTypeList.cs
- XmlDocumentType.cs
- DomainConstraint.cs
- EnumBuilder.cs
- JsonWriter.cs
- PackWebRequestFactory.cs
- IndicFontClient.cs
- XsdDateTime.cs
- HttpDebugHandler.cs
- InfoCardArgumentException.cs
- StreamBodyWriter.cs
- LoginCancelEventArgs.cs
- LabelLiteral.cs
- XmlElementCollection.cs
- StreamResourceInfo.cs
- ButtonBaseAutomationPeer.cs
- IsolatedStoragePermission.cs
- NavigationEventArgs.cs
- TokenizerHelper.cs
- AvTraceFormat.cs
- HScrollBar.cs
- FixedPageStructure.cs
- TrackingMemoryStream.cs
- DBDataPermission.cs
- ToolStripItemCollection.cs
- BaseParser.cs
- RadioButtonPopupAdapter.cs
- BuilderPropertyEntry.cs
- ReadOnlyDataSourceView.cs
- ControlParser.cs
- _Win32.cs
- SqlLiftWhereClauses.cs
- VersionPair.cs
- CornerRadiusConverter.cs
- AddInAttribute.cs
- Tool.cs
- HiddenFieldPageStatePersister.cs
- HierarchicalDataSourceConverter.cs
- Italic.cs
- HttpListenerRequest.cs
- HttpValueCollection.cs
- EditorServiceContext.cs
- DiscoveryClientOutputChannel.cs
- ArgumentValidation.cs
- ValueProviderWrapper.cs
- WasHttpHandlersInstallComponent.cs
- IDispatchConstantAttribute.cs
- DataGridColumnHeaderItemAutomationPeer.cs
- OdbcConnectionFactory.cs
- Label.cs
- XappLauncher.cs
- TextBlockAutomationPeer.cs
- DataGridViewColumnDividerDoubleClickEventArgs.cs
- BaseParagraph.cs
- SQLInt32Storage.cs
- ColumnWidthChangingEvent.cs
- EntryIndex.cs
- RequestSecurityTokenResponse.cs
- SQLDecimal.cs
- ConfigurationSectionGroup.cs
- WeakReferenceEnumerator.cs
- SnapLine.cs
- ETagAttribute.cs
- CompensatableTransactionScopeActivityDesigner.cs
- ResourceDictionary.cs
- relpropertyhelper.cs
- MenuAdapter.cs
- ControlBuilderAttribute.cs
- RegexCaptureCollection.cs
- CuspData.cs
- AttributeCallbackBuilder.cs
- Operand.cs
- TraceHwndHost.cs
- SQLMoney.cs
- ProcessHost.cs
- Renderer.cs
- TraceLevelStore.cs
- CollectionContainer.cs
- MenuItem.cs
- GuidConverter.cs
- TextProperties.cs
- StronglyTypedResourceBuilder.cs
- SimpleRecyclingCache.cs
- xmlfixedPageInfo.cs
- DataListItemCollection.cs
- XmlSchemas.cs
- ForwardPositionQuery.cs
- XmlSchemaExternal.cs