public QueryActiveServiceProductsResult GetActiveServiceProducts(string url, string token, EncryptionInfo encryptionInfo, KeyPair serviceKeys) { StatusServiceClient client = StatusServiceClientCreator(url); string encryptedToken = _symmetricEncryptionProvider.Encrypt(token, encryptionInfo); string encryptedResult = client.QueryActiveProductsAndLiceseSets(encryptedToken); string decryptedResult = _asymmetricEncryptionProvider.DecryptPublic(encryptedResult, serviceKeys); QueryActiveServiceProductsResult result = _objectSerializationProvider.Deserialize<QueryActiveServiceProductsResult>(decryptedResult); return result; }
public KeyPair GenerateKeyPair(BitStrengths bitStrength) { KeyPair kp = new KeyPair(); RsaKeyPairGenerator r = new RsaKeyPairGenerator(); r.Init(new KeyGenerationParameters(new SecureRandom(), 768)); AsymmetricCipherKeyPair keys = r.GenerateKeyPair(); kp.PublicKey = RsaPublicKeyToString((RsaKeyParameters)keys.Public); kp.PrivateKey = RsaPrivateKeyToString((RsaPrivateCrtKeyParameters)keys.Private); return kp; }
public GetAllLicenseActivationsResult GetAllServiceLicenseActivations(string url, string token, EncryptionInfo encryptionInfo, KeyPair serviceKeys) { ReportingServiceClient client = ReportingClientCreator(url); string encryptedToken = _symmetricEncryptionProvider.Encrypt(token, encryptionInfo); string encryptedResult = client.GetAllLicenseActivations(encryptedToken); string decryptedResult = _asymmetricEncryptionProvider.DecryptPublic(encryptedResult, serviceKeys); GetAllLicenseActivationsResult result = _objectSerializationProvider.Deserialize<GetAllLicenseActivationsResult>(decryptedResult); return result; }
public AddLicenseKeysForProductResult AddLicenseKeysForLicenseSet(string url, string token, EncryptionInfo encryptionInfo, KeyPair serviceKeys, AddLicenseKeysForProductData data) { ProductsServiceClient client = ProductClientCreator(url); string encryptedToken = _symmetricEncryptionProvider.Encrypt(token, encryptionInfo); string serializedPayload = _objectSerializationProvider.Serialize(data); string encryptedData = _asymmetricEncryptionProvider.EncryptPrivate(serializedPayload, serviceKeys); string encryptedResult = client.AddLicenseKeysForProduct(encryptedToken, encryptedData); string decryptedResult = _asymmetricEncryptionProvider.DecryptPublic(encryptedResult, serviceKeys); AddLicenseKeysForProductResult result = _objectSerializationProvider.Deserialize<AddLicenseKeysForProductResult>(decryptedResult); return result; }
public KeyPair GetManagementKeyPair() { MasterServiceData masterData = _commonRepository.GetMasterServiceData(); StringBuilder inboundKey = new StringBuilder(); inboundKey.Append(masterData.ManagementInboundKey); inboundKey.Append(GetInboundHalfFromFile()); StringBuilder outboundKey = new StringBuilder(); outboundKey.Append(masterData.ManagementOutboundKey); outboundKey.Append(GetOutboundHalfFromFile()); KeyPair keyPair = new KeyPair(); keyPair.PublicKey = inboundKey.ToString(); keyPair.PrivateKey = outboundKey.ToString(); return keyPair; }
public string DecryptPublic(string cipherText, KeyPair xml) { return Decrypt(cipherText, xml.PublicKey, false); }
public string EncryptPublic(string plainText, KeyPair xml) { return Encrypt(plainText, xml.PublicKey, false); }
public string DecryptPrivate(string cipherText, KeyPair xml) { return Decrypt(cipherText, xml.PrivateKey, true); }
public string EncryptPrivate(string plainText, KeyPair xml) { return Encrypt(plainText, xml.PrivateKey, true); }
private string SerializeAndEncryptResult(ActivationResult result, KeyPair keyPair) { string serializedResult = _serializationProvider.Serialize(result); string encryptedResult = _asymmetricEncryptionProvider.EncryptPrivate(serializedResult, keyPair); return encryptedResult; }
public void WireUp() { asymmetricEncryptionProvider = new AsymmetricEncryptionProvider(); _key = asymmetricEncryptionProvider.GenerateKeyPair(BitStrengths.High); }
public KeyPair GetManagementServiceKeyPair() { KeyPair kp = new KeyPair(); kp.PrivateKey = _managementInboundKeyPair.PrivateKey; kp.PublicKey = _managementOutboundKeyPair.PublicKey; return kp; }
public KeyPair GetClientServiceKeyPair() { KeyPair kp = new KeyPair(); kp.PrivateKey = _inboundKeyPair.PrivateKey; kp.PublicKey = _outboundKeyPair.PublicKey; return kp; }