public static ReadOnlyMemory <byte> GenerateFile( string password, Guid saltGuid, KrbPrincipalName name, EncryptionType etype = EncryptionType.AES256_CTS_HMAC_SHA1_96 ) { var salt = NormalizeGuid(saltGuid); var kerbKey = new KerberosKey( password: password, etype: etype, salt: salt, principalName: name.ToKeyPrincipal() ); using (var stream = new MemoryStream()) using (var writer = new BinaryWriter(stream)) { var keytab = new KeyTable(kerbKey); keytab.Write(writer); return(stream.ToArray()); } }
public static ReadOnlyMemory <byte> GenerateFile( string password, Guid saltGuid, KrbPrincipalName name, EncryptionType etype = EncryptionType.AES256_CTS_HMAC_SHA1_96 ) { var kerbKey = DeriveFromKeyId(password, saltGuid, name, etype); using (var stream = new MemoryStream()) using (var writer = new BinaryWriter(stream)) { var keytab = new KeyTable(kerbKey); keytab.Write(writer); return(stream.ToArray()); } }