European security firm Gemalto said on Friday that it has agreed to buy data protection firm SafeNet for $890 million in cash.