示例#1
0
 public OpenWOPIWebClient(string url, string access_token, string access_token_ttl, OpenWOPIProofKey proofKey)
 {
     _access_token     = access_token;
     _access_token_ttl = access_token_ttl;
     _utc      = DateTime.UtcNow;
     _proofkey = proofKey;
 }
示例#2
0
 public static void SaveToConfiguration(OpenWOPIProofKey key, string source)
 {
     string[] lines = new string[] {
         "proof:" + key.Proof,
         "proof-key:" + key.ProofWithKey,
         "old-proof:" + key.OldProof,
         "old-proof-key:" + key.OldProofWithKey
     };
     System.IO.File.WriteAllLines(source, lines);
 }
示例#3
0
        public static OpenWOPIProofKey ReadFromConfiguration(OpenWOPIConfiguration configuration)
        {
            OpenWOPIProofKey key = new OpenWOPIProofKey();

            key.Proof           = configuration["proof"];
            key.ProofWithKey    = configuration["proof-key"];
            key.OldProof        = configuration["old-proof"];
            key.OldProofWithKey = configuration["old-proof-key"];
            return(key);
        }
示例#4
0
 public static OpenWOPIProofKey GenerateNew(OpenWOPIProofKey oldKey)
 {
     using (RSACryptoServiceProvider serviceProvider = new RSACryptoServiceProvider(KeyLength))
     {
         OpenWOPIProofKey newKey = new OpenWOPIProofKey();
         newKey.OldProof        = oldKey.Proof;
         newKey.OldProofWithKey = oldKey.ProofWithKey;
         newKey.Proof           = System.Convert.ToBase64String(serviceProvider.ExportCspBlob(false));
         newKey.ProofWithKey    = System.Convert.ToBase64String(serviceProvider.ExportCspBlob(true));
         return(newKey);
     }
 }
示例#5
0
 public OpenWOPITextDocument(string source, OpenWOPIAccessToken accessToken, OpenWOPIProofKey proofKey)
     : base(source, accessToken, proofKey)
 {
     DocumentEncoding = Encoding.UTF8;
 }
示例#6
0
 public OpenWOPIDocument(string source, OpenWOPIAccessToken accessToken, OpenWOPIProofKey proofKey) : this()
 {
     AccessToken = accessToken;
     Source      = source;
     ProofKey    = proofKey;
 }