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
- QilTernary.cs
- WriteableBitmap.cs
- HtmlImage.cs
- EntryWrittenEventArgs.cs
- KerberosTicketHashIdentifierClause.cs
- DefaultObjectMappingItemCollection.cs
- DynamicMethod.cs
- PackageDigitalSignatureManager.cs
- InputScopeConverter.cs
- DataGridViewCellStyle.cs
- sqlstateclientmanager.cs
- XmlValidatingReaderImpl.cs
- GeometryModel3D.cs
- _Rfc2616CacheValidators.cs
- DataTableTypeConverter.cs
- SettingsProviderCollection.cs
- CertificateReferenceElement.cs
- CqlWriter.cs
- RegionInfo.cs
- CmsInterop.cs
- PeoplePickerWrapper.cs
- ScriptHandlerFactory.cs
- WebPartConnectionsCancelVerb.cs
- SafeBuffer.cs
- HttpPostedFile.cs
- ProcessThread.cs
- wgx_exports.cs
- EqualityArray.cs
- CollectionView.cs
- TextMarkerSource.cs
- TextElementEditingBehaviorAttribute.cs
- CqlLexerHelpers.cs
- VirtualDirectoryMappingCollection.cs
- MethodBody.cs
- XmlSerializationGeneratedCode.cs
- SuppressMessageAttribute.cs
- RSAOAEPKeyExchangeDeformatter.cs
- BitmapEffectrendercontext.cs
- MultiBinding.cs
- InkCollectionBehavior.cs
- Regex.cs
- DBParameter.cs
- JoinCqlBlock.cs
- SafeProcessHandle.cs
- RoleGroupCollection.cs
- TraceRecords.cs
- relpropertyhelper.cs
- TextTreeText.cs
- Exceptions.cs
- FieldNameLookup.cs
- SecurityKeyUsage.cs
- LocalizationComments.cs
- SizeIndependentAnimationStorage.cs
- SafeHGlobalHandleCritical.cs
- XsltOutput.cs
- ReadWriteSpinLock.cs
- Util.cs
- KeyManager.cs
- WindowsSysHeader.cs
- SQLDouble.cs
- ScrollProperties.cs
- TypeUtil.cs
- InputLangChangeEvent.cs
- ConversionContext.cs
- Identity.cs
- BoundField.cs
- WebPartsSection.cs
- Exceptions.cs
- Table.cs
- PropertyToken.cs
- BinarySecretKeyIdentifierClause.cs
- SmtpLoginAuthenticationModule.cs
- ReaderWriterLockSlim.cs
- FilterException.cs
- DoubleStorage.cs
- AlphabeticalEnumConverter.cs
- connectionpool.cs
- SchemaMapping.cs
- DocumentEventArgs.cs
- FormsIdentity.cs
- XmlSchemaInfo.cs
- XD.cs
- CodeGroup.cs
- DataSourceHelper.cs
- XPathDocument.cs
- DropDownButton.cs
- FileDialog_Vista_Interop.cs
- ScalarOps.cs
- DbProviderConfigurationHandler.cs
- VirtualizedItemPattern.cs
- ParameterToken.cs
- TreeNode.cs
- SaveFileDialog.cs
- DataSourceXmlClassAttribute.cs
- SqlTrackingService.cs
- ComplexBindingPropertiesAttribute.cs
- CopyAttributesAction.cs
- ScriptBehaviorDescriptor.cs
- ProfileBuildProvider.cs
- DataGridViewTextBoxColumn.cs