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 / HMACSHA512.cs / 1 / HMACSHA512.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== // // HMACSHA512.cs // namespace System.Security.Cryptography { [System.Runtime.InteropServices.ComVisible(true)] public class HMACSHA512 : HMAC { private bool m_useLegacyBlockSize = Utils._ProduceLegacyHmacValues(); // // public constructors // public HMACSHA512 () : this (Utils.GenerateRandom(128)) {} public HMACSHA512 (byte[] key) { Utils._ShowLegacyHmacWarning(); m_hashName = "SHA512"; m_hash1 = new SHA512Managed(); m_hash2 = new SHA512Managed(); HashSizeValue = 512; BlockSizeValue = BlockSize; base.InitializeKey(key); } private int BlockSize { get { return m_useLegacyBlockSize ? 64 : 128; } } ////// In Whidbey we incorrectly used a block size of 64 bytes for HMAC-SHA-384 and HMAC-SHA-512, /// rather than using the correct value of 128 bytes. Setting this to true causes us to fall /// back to the Whidbey mode which produces incorrect HMAC values. /// /// This value should be set only once, before hashing has begun, since we need to reset the key /// buffer for the block size change to take effect. /// /// The default vaue is off, however this can be toggled for the application by setting the /// legacyHMACMode config switch. /// /// We will also produce a warning when using either of these classes which is output to the /// debugger and event log unless the showLegacyHMACWarning config setting is disabled. This /// warning is generated for the first time either class is constructed. /// public bool ProduceLegacyHmacValues { get { return m_useLegacyBlockSize; } set { m_useLegacyBlockSize = value; BlockSizeValue = BlockSize; InitializeKey(KeyValue); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== // // HMACSHA512.cs // namespace System.Security.Cryptography { [System.Runtime.InteropServices.ComVisible(true)] public class HMACSHA512 : HMAC { private bool m_useLegacyBlockSize = Utils._ProduceLegacyHmacValues(); // // public constructors // public HMACSHA512 () : this (Utils.GenerateRandom(128)) {} public HMACSHA512 (byte[] key) { Utils._ShowLegacyHmacWarning(); m_hashName = "SHA512"; m_hash1 = new SHA512Managed(); m_hash2 = new SHA512Managed(); HashSizeValue = 512; BlockSizeValue = BlockSize; base.InitializeKey(key); } private int BlockSize { get { return m_useLegacyBlockSize ? 64 : 128; } } ////// In Whidbey we incorrectly used a block size of 64 bytes for HMAC-SHA-384 and HMAC-SHA-512, /// rather than using the correct value of 128 bytes. Setting this to true causes us to fall /// back to the Whidbey mode which produces incorrect HMAC values. /// /// This value should be set only once, before hashing has begun, since we need to reset the key /// buffer for the block size change to take effect. /// /// The default vaue is off, however this can be toggled for the application by setting the /// legacyHMACMode config switch. /// /// We will also produce a warning when using either of these classes which is output to the /// debugger and event log unless the showLegacyHMACWarning config setting is disabled. This /// warning is generated for the first time either class is constructed. /// public bool ProduceLegacyHmacValues { get { return m_useLegacyBlockSize; } set { m_useLegacyBlockSize = value; BlockSizeValue = BlockSize; InitializeKey(KeyValue); } } } } // 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
- DataGridViewCellErrorTextNeededEventArgs.cs
- RootBuilder.cs
- WebPartEditorApplyVerb.cs
- UniformGrid.cs
- ApplicationActivator.cs
- SafeRegistryHandle.cs
- WindowsFormsEditorServiceHelper.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- ScrollEventArgs.cs
- DbMetaDataColumnNames.cs
- NativeMethods.cs
- WebPartZoneBase.cs
- ListViewCommandEventArgs.cs
- SmtpNegotiateAuthenticationModule.cs
- MergeFilterQuery.cs
- DBSchemaRow.cs
- VerbConverter.cs
- MetaModel.cs
- CommonObjectSecurity.cs
- WebPartExportVerb.cs
- ContentPlaceHolder.cs
- AsnEncodedData.cs
- PropertyRecord.cs
- EntityContainerRelationshipSetEnd.cs
- ClientSideProviderDescription.cs
- HtmlSelect.cs
- HtmlTitle.cs
- AutomationElement.cs
- FileLogRecordStream.cs
- DataControlExtensions.cs
- xmlfixedPageInfo.cs
- invalidudtexception.cs
- ChoiceConverter.cs
- StateMachineWorkflowDesigner.cs
- UniqueEventHelper.cs
- IList.cs
- SelectionItemPattern.cs
- Part.cs
- ObjectDataSourceStatusEventArgs.cs
- HostingEnvironmentException.cs
- XsdCachingReader.cs
- PeerContact.cs
- Base64Decoder.cs
- QuerySettings.cs
- PreloadedPackages.cs
- CellLabel.cs
- CustomAssemblyResolver.cs
- Types.cs
- RectAnimationClockResource.cs
- FileRecordSequenceCompletedAsyncResult.cs
- FilterRepeater.cs
- Util.cs
- SecurityMode.cs
- MarshalByValueComponent.cs
- FastEncoder.cs
- printdlgexmarshaler.cs
- HostingPreferredMapPath.cs
- SiteMapDataSourceView.cs
- SubtreeProcessor.cs
- DataSvcMapFile.cs
- GenericIdentity.cs
- CollectionChange.cs
- ExceptionTrace.cs
- OdbcConnectionHandle.cs
- HtmlGenericControl.cs
- CustomTypeDescriptor.cs
- SvcMapFileLoader.cs
- SqlDataSourceQueryEditorForm.cs
- TimeSpanParse.cs
- StringArrayConverter.cs
- arabicshape.cs
- HelpInfo.cs
- DateTimeSerializationSection.cs
- TextWriterTraceListener.cs
- DrawListViewItemEventArgs.cs
- HttpContext.cs
- PathGradientBrush.cs
- sqlmetadatafactory.cs
- DbConnectionFactory.cs
- XamlFilter.cs
- FontStretches.cs
- AlphaSortedEnumConverter.cs
- TlsnegoTokenAuthenticator.cs
- IsolationInterop.cs
- WebScriptMetadataMessageEncoderFactory.cs
- OlePropertyStructs.cs
- BrushMappingModeValidation.cs
- DiagnosticsConfiguration.cs
- ResourceDictionaryCollection.cs
- FileInfo.cs
- BitmapInitialize.cs
- SymLanguageVendor.cs
- MaterialCollection.cs
- MetadataCache.cs
- PolicyDesigner.cs
- PostBackOptions.cs
- XpsFilter.cs
- SimpleTableProvider.cs
- PickBranchDesigner.xaml.cs
- UncommonField.cs