Exemplo n.º 1
0
        private string GetAuthDigest(string endpoint, AsymmetricCipherKeyPair keyPair)
        {
            byte[] digestBytes = Conversion.UtfToBytes("GET&" + endpoint);

            byte[] signedDigestBytes = CryptoEngine.SignDigest(digestBytes, keyPair);

            return(Conversion.BytesToBase64(signedDigestBytes));
        }
Exemplo n.º 2
0
        public YotiAttributeValue(TypeEnum type, string data)
        {
            _type = type;

            switch (_type)
            {
            case TypeEnum.Jpeg:
            case TypeEnum.Png:
                _data = Conversion.Base64ToBytes(data);
                break;

            default:
                _data = Conversion.UtfToBytes(data);
                break;
            }
        }
        public static string SignMessage(HttpMethod httpMethod, string endpoint, AsymmetricCipherKeyPair keyPair, byte[] content)
        {
            string stringToConvert = string.Format(
                "{0}&{1}",
                httpMethod.ToString(),
                endpoint);

            if (content != null)
            {
                stringToConvert += "&" + Conversion.BytesToBase64(content);
            }

            byte[] digestBytes       = Conversion.UtfToBytes(stringToConvert);
            byte[] signedDigestBytes = CryptoEngine.SignDigest(digestBytes, keyPair);

            return(Conversion.BytesToBase64(signedDigestBytes));
        }