Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- MatrixConverter.cs
- AssemblyNameProxy.cs
- CheckableControlBaseAdapter.cs
- HostProtectionPermission.cs
- WebServiceHandler.cs
- DataGridViewCellCollection.cs
- ButtonFlatAdapter.cs
- InfoCardKeyedHashAlgorithm.cs
- VectorAnimation.cs
- SqlGenerator.cs
- ObjectDataSourceDisposingEventArgs.cs
- MailAddress.cs
- _CommandStream.cs
- DateTimeAutomationPeer.cs
- fixedPageContentExtractor.cs
- DataSourceControlBuilder.cs
- AsyncResult.cs
- WindowsGraphicsWrapper.cs
- ApplicationSecurityInfo.cs
- HttpCapabilitiesEvaluator.cs
- TextPointerBase.cs
- BuildResult.cs
- XslAstAnalyzer.cs
- EnvironmentPermission.cs
- GridViewColumn.cs
- HttpApplicationFactory.cs
- MarshalByRefObject.cs
- WebBrowserProgressChangedEventHandler.cs
- WizardPanel.cs
- DataControlCommands.cs
- XmlSchemaAnnotation.cs
- StyleHelper.cs
- WebBrowserNavigatingEventHandler.cs
- AccessViolationException.cs
- Models.cs
- DataChangedEventManager.cs
- EndpointReference.cs
- ElementFactory.cs
- UrlPropertyAttribute.cs
- Module.cs
- BookmarkScope.cs
- WizardForm.cs
- StringPropertyBuilder.cs
- AnimatedTypeHelpers.cs
- SerializerDescriptor.cs
- SelectionManager.cs
- RichTextBoxConstants.cs
- ToolStripItemImageRenderEventArgs.cs
- glyphs.cs
- XmlSchemaParticle.cs
- FixedSOMFixedBlock.cs
- TraceLevelHelper.cs
- CommonRemoteMemoryBlock.cs
- DrawingContextDrawingContextWalker.cs
- BindingContext.cs
- CodePageUtils.cs
- SqlTriggerContext.cs
- MouseActionValueSerializer.cs
- SqlConnectionPoolGroupProviderInfo.cs
- GroupBox.cs
- RadioButtonList.cs
- OrderedDictionaryStateHelper.cs
- InvalidPropValue.cs
- ListenUriMode.cs
- PeerInvitationResponse.cs
- LayoutInformation.cs
- AffineTransform3D.cs
- RegexWorker.cs
- TreeWalkHelper.cs
- CacheChildrenQuery.cs
- DataGridViewTopRowAccessibleObject.cs
- TreeWalker.cs
- SqlRetyper.cs
- CodeArrayCreateExpression.cs
- StylusButtonEventArgs.cs
- DataRelationPropertyDescriptor.cs
- ToolStripHighContrastRenderer.cs
- ToolboxItemCollection.cs
- VoiceSynthesis.cs
- ComponentConverter.cs
- CloseSequenceResponse.cs
- FatalException.cs
- Translator.cs
- WebBrowserSiteBase.cs
- RawStylusInputCustomDataList.cs
- Path.cs
- KerberosSecurityTokenAuthenticator.cs
- SafeNativeMethods.cs
- GlyphTypeface.cs
- FileStream.cs
- SerialReceived.cs
- XmlSchemaAttributeGroupRef.cs
- ThicknessAnimationUsingKeyFrames.cs
- CSharpCodeProvider.cs
- DecoderNLS.cs
- UdpDiscoveryEndpointProvider.cs
- RoleProviderPrincipal.cs
- RoleManagerSection.cs
- OverflowException.cs
- SamlAssertionKeyIdentifierClause.cs