/// <summary> /// Decode a Gss_Wrap token from security buffers /// </summary> /// <param name="context">The context of decoding</param> /// <param name="securityBuffers">Security buffers</param> /// <returns>The decoded Gss_Wrap token.</returns> internal static KerberosPdu GssUnWrapEx(KerberosContext context, SecurityBuffer[] securityBuffers) { KerberosPdu pdu = null; EncryptionKey key = context.ContextKey; switch ((EncryptionType)key.keytype.Value) { case EncryptionType.AES128_CTS_HMAC_SHA1_96: case EncryptionType.AES256_CTS_HMAC_SHA1_96: var token4121Pdu = new Token4121(context); token4121Pdu.FromSecurityBuffers(securityBuffers); pdu = token4121Pdu; break; case EncryptionType.DES_CBC_CRC: case EncryptionType.DES_CBC_MD5: case EncryptionType.RC4_HMAC: case EncryptionType.RC4_HMAC_EXP: var token1964or4757Pdu = new Token1964_4757(context); token1964or4757Pdu.FromSecurityBuffers(securityBuffers); pdu = token1964or4757Pdu; break; default: throw new NotSupportedException("The Encryption Type can only be AES128_CTS_HMAC_SHA1_96, " + "AES256_CTS_HMAC_SHA1_96, DES_CBC_CRC, DES_CBC_MD5, RC4_HMAC or RC4_HMAC_EXP."); } return(pdu); }
internal static bool GssVerifyMicEx(KerberosContext context, SecurityBuffer[] securityBuffers, out KerberosPdu pdu) { pdu = null; bool isVerified = true; EncryptionKey key = context.ContextKey; switch ((EncryptionType)key.keytype.Value) { case EncryptionType.AES128_CTS_HMAC_SHA1_96: case EncryptionType.AES256_CTS_HMAC_SHA1_96: var micPdu4121 = new Token4121(context); try { micPdu4121.FromSecurityBuffers(securityBuffers); } catch (FormatException) { isVerified = false; } pdu = micPdu4121; break; case EncryptionType.DES_CBC_CRC: case EncryptionType.DES_CBC_MD5: case EncryptionType.RC4_HMAC: case EncryptionType.RC4_HMAC_EXP: var micPdu1964_4757 = new Token1964_4757(context); try { micPdu1964_4757.FromSecurityBuffers(securityBuffers); } catch (FormatException) { isVerified = false; } pdu = micPdu1964_4757; break; default: throw new NotSupportedException("The Encryption Type can only be AES128_CTS_HMAC_SHA1_96, " + "AES256_CTS_HMAC_SHA1_96, DES_CBC_CRC, DES_CBC_MD5, RC4_HMAC or RC4_HMAC_EXP."); } return(isVerified); }
public void Encrypt(KerberosContext context) { }
public void Decrypt(KerberosContext context) { throw new NotImplementedException(); }
public void Decrypt(KerberosContext context) { throw new NotImplementedException(); }
public void Encrypt(KerberosContext context) { }