Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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. // // ==--== // // 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TextEffect.cs
- ToolStripDropDownItem.cs
- Configuration.cs
- WindowsStatusBar.cs
- TransformerInfo.cs
- DoubleCollection.cs
- ActiveXHelper.cs
- BooleanExpr.cs
- SessionPageStatePersister.cs
- AccessorTable.cs
- DbSetClause.cs
- SortAction.cs
- FocusWithinProperty.cs
- MimeWriter.cs
- WindowsStartMenu.cs
- ObjectDataSourceDisposingEventArgs.cs
- Rotation3DAnimationBase.cs
- WebPartEditorApplyVerb.cs
- HttpResponseInternalBase.cs
- DataGridViewControlCollection.cs
- SspiSafeHandles.cs
- MetadataArtifactLoaderComposite.cs
- ConnectionProviderAttribute.cs
- HelloOperationAsyncResult.cs
- Vector3DCollectionConverter.cs
- MatrixValueSerializer.cs
- GlyphTypeface.cs
- FileVersionInfo.cs
- DesignerObjectListAdapter.cs
- GridViewColumn.cs
- odbcmetadatacollectionnames.cs
- EtwTrace.cs
- RoleManagerSection.cs
- OutputCacheSettingsSection.cs
- CodeArrayIndexerExpression.cs
- SimpleMailWebEventProvider.cs
- XmlNullResolver.cs
- HttpCapabilitiesSectionHandler.cs
- StrokeCollectionDefaultValueFactory.cs
- WebScriptEnablingElement.cs
- SafeEventHandle.cs
- DesignerTransactionCloseEvent.cs
- ItemContainerGenerator.cs
- DesignerForm.cs
- WindowsAuthenticationEventArgs.cs
- XamlClipboardData.cs
- GeneralTransform.cs
- AssemblySettingAttributes.cs
- SoapSchemaImporter.cs
- Win32.cs
- TemplateLookupAction.cs
- CodeMethodReturnStatement.cs
- PieceDirectory.cs
- String.cs
- WindowsScroll.cs
- WindowsClientCredential.cs
- Polyline.cs
- SecurityStandardsManager.cs
- ActivityIdHeader.cs
- EntitySetBaseCollection.cs
- ACE.cs
- LinkedResourceCollection.cs
- SecurityChannel.cs
- ErrorInfoXmlDocument.cs
- MailWebEventProvider.cs
- BitHelper.cs
- FileCodeGroup.cs
- ApplicationFileCodeDomTreeGenerator.cs
- ScriptingProfileServiceSection.cs
- MemberAccessException.cs
- JavaScriptString.cs
- ConfigurationManagerHelperFactory.cs
- SharedPerformanceCounter.cs
- ClientRolePrincipal.cs
- MatrixStack.cs
- EntityClassGenerator.cs
- Scheduler.cs
- PeerEndPoint.cs
- DataObjectSettingDataEventArgs.cs
- SessionPageStatePersister.cs
- NotificationContext.cs
- HttpResponseBase.cs
- OutputScope.cs
- Matrix3D.cs
- EntitySetRetriever.cs
- MetadataUtil.cs
- GridViewDeletedEventArgs.cs
- XamlTemplateSerializer.cs
- ListViewHitTestInfo.cs
- FixedPageAutomationPeer.cs
- DllNotFoundException.cs
- DATA_BLOB.cs
- IxmlLineInfo.cs
- OdbcConnectionHandle.cs
- Rules.cs
- TransformCollection.cs
- TextRangeBase.cs
- ViewRendering.cs
- SqlGenericUtil.cs
- XmlSchemaAnyAttribute.cs