public DerivedKeyToken(byte [] origKey) { length = XmlSigHandler.NumKeyBytes; secTokRef = new SecurityTokenReference(); secTokRef.Reference = new Reference(); secTokRef.Reference.ValueType = "http://schemas.xmlsoap.org/ws/2004/04/security/sc/sct"; byte [] baNonce = OpenNETCF.Security.Cryptography.NativeMethods.Rand.GetRandomBytes(20); nonce = Convert.ToBase64String(baNonce, 0, baNonce.Length); derKey = P_SHA1.DeriveKey(origKey, this.label, baNonce, length); System.Guid g = GuidEx.NewGuid(); this.id = "SecurityToken-" + g.ToString("D"); }
public DerivedKeyToken(byte [] origKey) { System.Security.Cryptography.RNGCryptoServiceProvider rng = new System.Security.Cryptography.RNGCryptoServiceProvider(); length = XmlSigHandler.NumKeyBytes; secTokRef = new SecurityTokenReference(); secTokRef.Reference = new Reference(); secTokRef.Reference.ValueType = "http://schemas.xmlsoap.org/ws/2004/04/security/sc/sct"; byte[] baNonce = new byte[20];// OpenNETCF.Security.Cryptography.Internal.Rand.GetRandomBytes(20); rng.GetBytes(baNonce); nonce = Convert.ToBase64String(baNonce, 0, baNonce.Length); derKey = P_SHA1.DeriveKey(origKey, this.label, baNonce, length); System.Guid g = Guid.NewGuid(); this.id = "SecurityToken-" + g.ToString("D"); }