コード例 #1
0
        public SigningOutput SignContent(string serializedRequest)
        {
            var hashManager = new HashManager();
            var privateKey  = KeyStoreAdapter.GetPrivateKeyForUser(SignatoryReference);

            var envolope = SigningEnvelope <string> .Create(serializedRequest, SignatoryReference, SignatoryEmail, SignatoryIpAddress);

            var hashSigningContent = hashManager.HashContent(envolope.Body);

            var rsaEncryptor = new Chilkat.Rsa {
                EncodingMode = EncodingMode
            };

            rsaEncryptor.ImportPrivateKey(privateKey);

            var encryptedSignContentHash = rsaEncryptor.EncryptStringENC(hashSigningContent, true);

            envolope.AddEncryptedHashForBody(encryptedSignContentHash);

            var symmetricKey = KeyStoreAdapter.GetSymmetricKeyForUser(SignatoryReference);

            var serializedSignedContent = JsonConvert.SerializeObject(envolope);
            var encryptedSignedString   = Encrypt(serializedSignedContent, symmetricKey);

            return(SigningOutput.Create(encryptedSignedString, SignatoryReference));
        }
コード例 #2
0
        public SigningOutput SignContent(string serializedRequest)
        {
            var salt     = Guid.NewGuid().ToString();
            var envolope = SigningEnvelope <string> .Create(serializedRequest, Signatory, SignatoryEmail, SignatoryIpAddress);

            envolope.AddEncryptedHashForBody(HashValue);

            var serializedSignedContent = JsonConvert.SerializeObject(envolope);

            return(SigningOutput.Create(serializedSignedContent, Signatory));
        }