2017-02-10 51 views
0

爲了安全起見,GitHub忽略了EphemeralKeyRingEphemeralKeyRing類的Asp.Net核心源代碼在哪裏?

這是一個腦筋急轉彎。最近我花了不少時間閱讀和吸收與asp.net核心會話存儲和asp.net核心數據保護相關的類的層次結構。在這些旅程中,我遇到了參考EphemeralKeyRing課程。然而,這個類的代碼似乎不在GitHub上的Asp.Net Core源代碼庫中。同樣奇怪的是,當對這個類名稱進行谷歌搜索時,我在因特網上的任何地方都找不到任何這個關於這個asp.net核心類的東西,而不是使用它的一個GitHub源代碼文件。

這裏是新聞了EphemeralKeyRing對象的類:https://github.com/aspnet/DataProtection/blob/rel/1.1.0/src/Microsoft.AspNetCore.DataProtection/EphemeralDataProtectionProvider.cs

enter image description here

這裏有一個GitHub的搜索在Asp.Net核心庫中的EphemeralKeyRing類的結果:

enter image description here

當搜索EphemeralKeyRing時,這裏是一個非常稀少的谷歌搜索結果集。注意第一個條目是我上面提到的使用該對象的GitHub上的代碼文件,其他結果與此asp.net核心類無關。

enter image description here

所以我的問題是這樣的:是爲從GitHub故意省略出於安全原因,EphemeralKeyRing類的源代碼?或者它在那裏,我只是在尋找錯誤?

回答

1

這裏是鏈接: https://github.com/aspnet/DataProtection/blob/master/src/Microsoft.AspNetCore.DataProtection/EphemeralDataProtectionProvider.cs

,我看到你發現已經點擊就可以了。如果你到頁面底部,你會看到你正在尋找的課程,我會粘貼代碼以防萬一:

private sealed class EphemeralKeyRing<T> : IKeyRing, IKeyRingProvider 
      where T : IInternalAuthenticatedEncryptionSettings, new() 
     { 
      // Currently hardcoded to a 512-bit KDK. 
      private const int NUM_BYTES_IN_KDK = 512/8; 

      public IAuthenticatedEncryptor DefaultAuthenticatedEncryptor { get; } = new T().ToConfiguration(services: null).CreateNewDescriptor().CreateEncryptorInstance(); 

      public Guid DefaultKeyId { get; } = default(Guid); 

      public IAuthenticatedEncryptor GetAuthenticatedEncryptorByKeyId(Guid keyId, out bool isRevoked) 
      { 
       isRevoked = false; 
       return (keyId == default(Guid)) ? DefaultAuthenticatedEncryptor : null; 
      } 

      public IKeyRing GetCurrentKeyRing() 
      { 
       return this; 
      } 
} 
+0

謝謝你!這太瘋狂了,我錯過了。我想這是因爲當我搜索存儲庫時,它顯示了文件,但只在文件中顯示了兩個引用,實際上有三分之一,而第三個是類聲明。 –

+0

不用擔心,我一直在那裏:) –