Code:
/ FX-1434 / FX-1434 / 1.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
- ScaleTransform.cs
- DataSource.cs
- SessionStateUtil.cs
- DataControlLinkButton.cs
- ProfileProvider.cs
- AdornerPresentationContext.cs
- XmlSchemaSimpleTypeRestriction.cs
- XhtmlTextWriter.cs
- XmlReflectionMember.cs
- PreProcessInputEventArgs.cs
- FormView.cs
- EntityClassGenerator.cs
- _SSPIWrapper.cs
- CultureTable.cs
- MulticastDelegate.cs
- AsyncResult.cs
- ClientSettingsProvider.cs
- DynamicEntity.cs
- FontDriver.cs
- HttpValueCollection.cs
- HttpListenerRequestUriBuilder.cs
- TdsRecordBufferSetter.cs
- UIElementParaClient.cs
- SyndicationSerializer.cs
- HostedHttpTransportManager.cs
- ContentElementAutomationPeer.cs
- ApplicationServiceManager.cs
- AttributeAction.cs
- MergeLocalizationDirectives.cs
- BoundColumn.cs
- AutomationPropertyInfo.cs
- GetWorkflowTree.cs
- MembershipValidatePasswordEventArgs.cs
- ElementsClipboardData.cs
- XmlSchemaInfo.cs
- XPathSingletonIterator.cs
- HelpExampleGenerator.cs
- WindowPattern.cs
- PrintDialog.cs
- QilFunction.cs
- MapPathBasedVirtualPathProvider.cs
- SchemaType.cs
- DbDataRecord.cs
- OdbcDataAdapter.cs
- _RequestCacheProtocol.cs
- Rule.cs
- RightsManagementSuppressedStream.cs
- EdmRelationshipRoleAttribute.cs
- MaskPropertyEditor.cs
- SchemaCollectionPreprocessor.cs
- QueueProcessor.cs
- SparseMemoryStream.cs
- DeclaredTypeValidator.cs
- Source.cs
- CommittableTransaction.cs
- StrokeSerializer.cs
- DataControlFieldCell.cs
- KeyboardDevice.cs
- PlainXmlWriter.cs
- MeshGeometry3D.cs
- EventMap.cs
- PeerNearMe.cs
- NTAccount.cs
- StylusPoint.cs
- SegmentInfo.cs
- RegexEditorDialog.cs
- DragCompletedEventArgs.cs
- ReferenceSchema.cs
- Operators.cs
- FlatButtonAppearance.cs
- PrintDialog.cs
- ListItemCollection.cs
- ConnectionOrientedTransportBindingElement.cs
- Section.cs
- WebContentFormatHelper.cs
- UnsettableComboBox.cs
- AppDomainGrammarProxy.cs
- DependencyPropertyDescriptor.cs
- FileLogRecordStream.cs
- PropertyGrid.cs
- Scene3D.cs
- BulletChrome.cs
- _ServiceNameStore.cs
- PoisonMessageException.cs
- MemberDescriptor.cs
- METAHEADER.cs
- OrCondition.cs
- AppSecurityManager.cs
- AnnotationHighlightLayer.cs
- OrderByQueryOptionExpression.cs
- FormCollection.cs
- StringBuilder.cs
- ConfigurationErrorsException.cs
- ExtenderControl.cs
- SQLConvert.cs
- XmlSchemaInclude.cs
- StickyNoteContentControl.cs
- DataGridToolTip.cs
- IHttpResponseInternal.cs
- FragmentQueryKB.cs