2017-02-10 91 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

不用担心,我一直在那里:) –